jQWidgets Forums

jQuery UI Widgets Forums Grid Ensurerowvisible API

This topic contains 2 replies, has 2 voices, and was last updated by  MBTree 5 years, 10 months ago.

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
  • Ensurerowvisible API #105140

    MBTree
    Participant

    The API says that the input parameter for ensurerowvisible is a bound index, but it functions like its a visible index.

    Just look at the Demo given with the API: http://jsfiddle.net/jqwidgets/hBM5L/

    click the button and it will go to the 100th row. After sorting by a column though, that element should retain its bound index, but move to a new visible index. However, clicking the button keeps returning to the 100th visible element.

    This is especially frustrating because if it worked as explained, it would be very simple to keep track of the row being edited while the grid is sorted.

    As it stands, editing the grid while sorted is a nightmare when there are enough rows to require scrolling.

    Ensurerowvisible API #105188

    Peter Stoev
    Keymaster

    Hi MBTree,

    You can use a code like that:

     $('#jqxbutton').click(function () {
         var rows = $("#jqxgrid").jqxGrid('getrows');
         var rowVisibleIndex = -1;
         
         for(var i = 0; i < rows.length; i++) {
             if (rows[i].boundindex === 100) {
                 rowVisibleIndex = i;
                 break;
             }			
         }
         $('#jqxgrid').jqxGrid('ensurerowvisible', rowVisibleIndex);
     });

    The code above gets a visible index by a bound index in our Grid. Works after sorting the Grid, too.

    Best Regards,
    Peter Stoev

    jQWidgets Team
    https://www.jqwidgets.com

    Ensurerowvisible API #105199

    MBTree
    Participant

    Peter,

    Thanks for the helpful code, that’ll do just what I need. I mostly just wanted to bring to your attention the issue with the API documentation, so people don’t waste their time with wrong information like I did.

    Best,
    MB

Viewing 3 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic.