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
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”);
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