jQWidgets Forums

Forum Replies Created

Viewing 9 posts - 1 through 9 (of 9 total)
  • Author
    Posts

  • jonj
    Member

    That was what I was missing. I was using the literal position-based index, not the bound index. Thank you for the clarification.

    My new code:

    var griddata = $('#jqxGrid').jqxGrid('getdatainformation'); // griddata.rowscount = total rows
    var selected = $('#jqxGrid').jqxGrid('selectedrowindexes');
    var rows = [];
    for (var r = 0; r < griddata.rowscount; r++) {
    var row = $('#jqxGrid').jqxGrid('getrenderedrowdata', r);
    for (var s in selected)
    if (row.boundindex == selected[s])
    rows.push(row);
    }

    Thank you!

    in reply to: get all data in Grid get all data in Grid #5173

    jonj
    Member

    Make that:

    console.log(JSON.stringify(rows));

    … for string based JSON (from object) output 🙂


    jonj
    Member

    BTW, in the midst of getting your input/help, may I thank you for what a wonderful product you have created. Amazing. 🙂


    jonj
    Member

    The scenario is that if you select multiple rows and call

    var selected = $('#jqxGrid').jqxGrid('selectedrowindexes');

    then the reference is correct. But if you resort, and call the same function, the “selected” array does not point to the same rows.

    in reply to: get all data in Grid get all data in Grid #5129

    jonj
    Member

    NHHL,

    Just do this and convert to JSON:

    http://www.jqwidgets.com/community/topic/traversing-grid-content/

    var griddata = $('#jqxGrid').jqxGrid('getdatainformation');
    var rows = [];
    for (var i = 0; i < griddata.rowscount; i++)
    rows.push($('#jqxGrid').jqxGrid('getrenderedrowdata', i));
    console.log(JSON.parse(rows));

    You can also do the same with:

    var selected = $('#jqxGrid').jqxGrid('selectedrowindexes');

    .. and then just iterate through selected rows (“selected” will be an array).

    in reply to: Traversing grid content 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.


    jonj
    Member

    A different piece of data is selected post-sort, regardless of visual order. In other words, if I have item 1, item 2, item 3, item 4, and item 5, and select item 2, when I resort, item 3 might be selected.

    Is that the intended behavior? Do I need to run an update to re-bind the select post-sort?

    in reply to: Traversing grid content 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);
    }

    in reply to: Traversing grid content 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?

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