jQuery UI Widgets Forums Grid Select row after pagechanged

This topic contains 1 reply, has 2 voices, and was last updated by  Hristo 8 years, 3 months ago.

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
  • Select row after pagechanged #90744

    rbrink
    Participant

    I try to select the first row of the grid when the page is changed. I have no luck with that so far, I try to use the pagechanged event but that doesn’t work as the grid is not rendered.
    What is the best way to select the first row when the page is changed?

    Thanks

    Select row after pagechanged #90763

    Hristo
    Participant

    Hello rbrink,

    If you mean first row of each page be selected.
    In that case, I would like to suggest you this approach:

    $('#jqxgrid').jqxGrid('selectrow', 0);
    
    $('#jqxgrid').on('pagechanged', function (event) {
      // event arguments.
      var args = event.args;
      // page number.
      var pagenum = args.pagenum;
      // page size.
      var pagesize = args.pagesize;
      
      var currentFirstRow = pagenum * pagesize;
      var index = $('#jqxgrid').jqxGrid('getrowboundindex', currentFirstRow);
    	$('#jqxgrid').jqxGrid('selectrow', index);
    });

    Best Regards,
    Hristo Hristov

    jQWidgets team
    http://www.jqwidgets.com

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

You must be logged in to reply to this topic.