Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by Scott Bailey on Aug 28, 2008 08:23
open dhtmlx forum
SortingImgState and sortRows difference

Hello,

There appears to be a difference in how these two functions deal with column ids? We have grid where certain columns are hidden acoording to the users preferences. In order to get the relevant id of the row I use

var namecolid=mygrid.getColIndexById("Name");

This returns the correct ID. So for example I have the following columns

Permissions,Access No, ESN, Company,Assigned On,Name,Type,Group

Permission is a hidden column. ID of name is 5 so

mygrid.sortRows(namecolid,"str","asc"); works correctly and sorts on this column.

However
mygrid.setSortImgState(true,namecolid,"asc");

Ignores the hidden column and put the image in the next column? It treats the Name Column as Column 4 (assuming no other columns are hidden?)

Is this behaviour correct and how can I reference the correct column for setSortImgState

Thanks


Answer posted by Support on Aug 28, 2008 10:20
While behavior looks not very logical, it is correct, the grid understood indexes correctly and when you specify to set sorting image to column 5 it sets the image to position where column will be in visible state. setSortImgState was not purposed to be used agains hidden columns - it is a pretty rare use-case.

You can try to change used code as

mygrid.setSortImgState(!mygrid.isColumnHidden(namecolid),namecolid,"asc");
Answer posted on Aug 29, 2008 00:44

Many thanks,

I have worked a way around this. The column I want the image to be on is not hidden - its the one before that. But because that's hidden it changes the position of the coulm in terms of visible poistion.

Scott