jQWidgets Forums
jQuery UI Widgets › Forums › Grid › Selected row when sorting
Tagged: javascript datagrid
This topic contains 9 replies, has 2 voices, and was last updated by cosostones 11 years, 11 months ago.
-
Author
-
Hello,
I have a problem with the grid to select a particular row from its index when a column is sorted.
I made a sample from your website sample to show the problem. Try to select the row 0 when the second column is sorted, the selected row is not the fisrt in the grid.
How can I select the correct row ?
Link for the sample : https://skydrive.live.com/redir?resid=E9406B1123B83936!109&authkey=!AEvy4XiaFXDtOWM
Regards.
Hi cosostones,
The selection is by Bound Index(data source index), not by Display index. If you want to select a row by its Display Index via the Grid’s API, you should do the following:
$("#selectrowbutton").click(function () { var index = parseInt($("#rowindexinput").val()); if (!isNaN(index)) { var visibleindex = $("#jqxgrid").jqxGrid('getrowboundindex', index); $("#jqxgrid").jqxGrid('selectrow', visibleindex); } });
Best Regards,
Peter StoevjQWidgets Team
http://www.jqwidgets.com/Hi Peter,
Thanks for the example it works but only when the row is visible. I tries to call the ‘ensurerowvisible’ method before ‘selectrow’ to scroll to the row but it has no effect.
How can I do this ?Regards.
Hi,
Please, post the code which demonstrates your scenario.
Best Regards,
Peter StoevjQWidgets Team
http://www.jqwidgets.com/Hi,
You can use the following code:
$("#selectrowbutton").click(function () { var index = parseInt($("#rowindexinput").val()); if (!isNaN(index)) { var boundindexFromVisibleIndex = $("#jqxgrid").jqxGrid('getrowboundindex', index); $("#jqxgrid").jqxGrid('selectrow', boundindexFromVisibleIndex); $("#jqxgrid").jqxGrid('ensurerowvisible', index); //$("#jqxgrid").jqxGrid('selectrow', index); } });
The code above is tested with jQWidgets 2.8.3.
Best Regards,
Peter StoevjQWidgets Team
http://www.jqwidgets.com/Hi,
I try your code but it seems not working for me, I made a video to show you :
http://screencast.com/t/cVf0ckr7dPflThe sample with your code is available at :
https://skydrive.live.com/redir?resid=E9406B1123B83936!112&authkey=!ALs_FtASTPDdhlIRegards.
Hi cosostones,
Do you use version 2.8.3? As I pointed out in my previous post, the code is tested with version 2.8.3 and uses API from that version.
Best Regards,
Peter StoevjQWidgets Team
http://www.jqwidgets.com/Effectively I didn’t use the latest version, with it it works great.
Thanks for your help.
I have another question, is there a way to specifiy a row with groups ?
Regards.
Is anyone can help me ?
-
AuthorPosts
You must be logged in to reply to this topic.