jQWidgets Forums

jQuery UI Widgets Forums Grid Export Specific rows from Grid

This topic contains 1 reply, has 2 voices, and was last updated by  Martin 7 years, 2 months ago.

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
  • Export Specific rows from Grid #99977

    Swapnil
    Participant

    Hello,

    We have a grid with lots of data and we use pagination.
    We have 2 exports in our grids.
    1. to export all the rows – This works well with $grid.jqxGrid(‘exportdata’, ‘json’)
    2. Export specific page – Here I need help to see if we can export the specific page (20 records) from the grid.

    In the documentation I see there is parameter called “rows” for exportData method. But I am not sure how I can use it here.

    Please let me know if I can export the specific page from the grid.

    Thanks,
    Swapnil.

    Export Specific rows from Grid #100015

    Martin
    Participant

    Hello Swapnil,

    You can export specific rows from the grid.
    You need to push the row’s data in an array and pass this array to the exportData method as the “rows” parameter.

    Here is an example:

    let rowId;
    let rowData;
    let arr = [];
    for (let i = 3; i <= 9; i+=1) {
    rowId = $(‘#grid’).jqxGrid(‘getrowid’, i);
    rowData = $(‘#grid’).jqxGrid(‘getrowdatabyid’, rowId);
    arr.push(rowData);
    }

    $(“#jsonExport”).click(function () {
    $(“#grid”).jqxGrid(‘exportdata’, ‘json’, ‘jqxGrid’, true, arr);
    });

    This will export the data from the 4th to the 10th row of the grid.

    Best Regards,
    Martin

    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.