jQuery UI Widgets Forums Grid grid

Tagged: 

This topic contains 1 reply, has 2 voices, and was last updated by  Peter Stoev 11 years, 1 month ago.

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    grid Posts
  • grid #53084

    Anil Kumar
    Participant

    I am using jqxGrid as shown as below
    createGrid = function (data) {
    var source = {
    datatype: “json”,
    datafields: [
    { name: ‘ProfileID’ }

    ],
    localdata: data
    };
    The grid has selection mode ‘singlerow’.
    For row select I have code like below
    $(‘#jqxgrid’).on(‘rowselect’, function (event) {
    var selectedRowIndex = $(“# jqxgrid'”).jqxGrid(‘selectedrowindex’);
    var selectedRow = $(“# jqxgrid'”).jqxGrid(‘getboundrows’)[selectedRowIndex];
    var displayedRows = $(“# jqxgrid'”).jqxGrid(‘getdisplayrows’);
    var rowVisibleIndex = -1;
    for (var i = 0; i < displayedRows.length; i++) {
    if (displayedRows[i].uid === selectedRow.uid) {
    rowVisibleIndex = i;
    break;
    }
    }

    var rows = $(‘# jqxgrid’).jqxGrid(‘getrows’);
    $(‘#totCountExistingProfile’).text(rows.length);
    $(‘#selectRowIndexExistingProfile’).text((rowVisibleIndex + 1));
    $(‘#ofExistingProfile’).text(‘ of ‘);
    });
    But after sort it is returning old index. But if I use selection mode ‘multiplerowsextended’ it is returning new index after sort. Please let me know what should I do for selection mode ‘singlerow’ for getting new index after sort?

    grid #53086

    Peter Stoev
    Keymaster

    Hi Anil Kumar,

    The row’s ID is not changed when you sort/filter the Grid and the row’s id is not Index as well. IF you want to get the rows in the order they’re displayed in the Grid, you should call the “getrows” method. I also suggest you to use only public API and not internal such as uid.

    Best Regards,
    Peter Stoev

    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.