jQWidgets Forums

jQuery UI Widgets Forums Grid Traversing grid content

This topic contains 4 replies, has 2 voices, and was last updated by  jonj 12 years, 11 months ago.

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
  • Traversing grid content #4988

    jonj
    Member

    What is the syntax to traverse the content of a grid? I am seeking to enumerate all rows and retrieve some values from the object[i].column if possible. Thanks.

    Traversing grid content #4995

    jonj
    Member

    Anyone? I really can’t believe the only way to get the current grid results, including filter/sort/edit info on all rows is by listening with bound events and trying to replicate the update(s) in the bound source?! Surely you can just enumerate/iterate the grid object rows/cols somehow?

    Traversing grid content #4997

    jonj
    Member

    Well, after some head-beating, I think I have a path using this. Is there a way to get the grid “ubound” in case I wanted “all” not just “selected”?

    var rowindexes = $('#jqxgrid').jqxGrid('getselectedrowindexes');
    for (var i in rowindexes) {
    var data = $('#jqxgrid').jqxGrid('getrenderedrowdata', rowindexes[i]);
    console.log(data);
    }

    Traversing grid content #5001

    Peter Stoev
    Keymaster

    Hi jonj,

    The ‘getrenderedrowdata’ method accepts as a parameter the index of a Grid row and returns the row’s data. To get the rows count, sorting, paging or filtering information, you may use the ‘getdatainformation ‘ method. Having the rows count, you can loop through the rows and call the ‘getrenderedrowdata’. Another possible solution is to use the jqxDataAdapter’s records field as the Grid is bound through a data adapter plug-in. When the data is loaded, it is saved in the jqxDataAdapter’s records field.

    Example:

    var dataAdapter = new $.jqx.dataAdapter(source, {
    loadComplete: function () {
    var records = dataAdapter.records;
    }
    });

    Best Regards,
    Peter Stoev

    jQWidgets Team
    http://www.jqwidgets.com

    Traversing grid content #5077

    jonj
    Member

    The method ‘getdatainformation’ object worked for me (accessible parameter for rowcount therein) to get the row count and then iterate through using ‘getrenderedrowdata’ per row. Thanks.

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

You must be logged in to reply to this topic.