jQWidgets Forums
jQuery UI Widgets › Forums › Grid › How do you get RowIndex by RowID?
Tagged: Row RowID RowIndex Index ID Sort
This topic contains 7 replies, has 2 voices, and was last updated by Peter Stoev 11 years, 1 month ago.
-
Author
-
I have a list of RowId’s and I want to get the row index for those rows. The reason is that when I sort my grid the row number change and I want to use the row id to get the row index.
Thanks for your help
Hi jr,
The bound index never changes and it does not matter whether you sort or filter the Grid. Only the display index is changed with such opetaions.
However, if you wish to use row id and get a row index, you may use the getrowboundindexbyid method. Ex: http://jsfiddle.net/jqwidgets/hWWqW/Hope this helps.
Best Regards,
Peter StoevjQWidgets Team
http://www.jqwidgets.com/very impressed with how fast you guys respond, thanks
as you can see in the picture above, what I am trying to get is the number highlighted. I am using that id to manipulate the row’s color.
When the grid is not sorted, this number happens to be the same as the rowID but not after sorting. Is there a way to get this number Im looking for?Hi jr,
Let me explain what happens to the selected row after you sort the Grid. The selected row remains the same data row which you selected. Its Display Index is Changed only i.e it would be on another position in the view, i.e you select data row and it does not change when you sort, filter the Grid. The HTML Element’s ID is not related to the Data Row’s ID, Bound Index or Display Index. The Data Row’s ID depends on your data source and especially whether you have set or not the source object’s id member. The bound index is the row’s index in the data source and the display index – that’s the index where the row is displayed in the view. That is the index that is changed when you sort, filter the Grid.
Best Regards,
Peter StoevjQWidgets Team
http://www.jqwidgets.com/is there a way to get the id that will be used for the HTML div for a row if you have the rowID?
Hi jr,
No, you should not try to work with the HTML Elements. They are generated automatically by our Grid. My suggestion is to use only the documented Grid API when you work with it.
Best Regards,
Peter StoevjQWidgets Team
http://www.jqwidgets.com/ -
AuthorPosts
You must be logged in to reply to this topic.