Sequenzia
Sequenzia

Reputation: 2381

jqGrid export data AJAX

I am trying to export all of the data from a grid. I wrote a function that does all of the exporting to excel. I just need to get the data from the grid.

I have it working using:

$("#grid").jqGrid('excelExport',{"url":"gridExport.php"});

I have a jquery click function that runs that and it works but it redirects the gridExport.php. I am trying to get this to open without moving the page.

I tried to just write my own jquery post function to the gridExport.php but I am not getting all of the params I need from the grid. I am assuming I can manually grab all the params I need and send them to the gridExport.php but I am not 100% how to do that and/or if there is an easier way to do it.

Any help on this would be great.

Thanks!

UPDATE:

I figured out a way to make this work. I just used my own jquery post function and got the paramas I needed from the grid and passed it to my processing page via the post function. I just needed the postData and colModel form my grid. This is how I got the params and put them into JS variables:

        var gParam = $("#grid").jqGrid('getGridParam','postData');
        var gParamCol = $("#grid").jqGrid('getGridParam','colModel');

Upvotes: 0

Views: 1350

Answers (1)

Sequenzia
Sequenzia

Reputation: 2381

I figured out a way to make this work. I just used my own jquery post function and got the paramas I needed from the grid and passed it to my processing page via the post function. I just needed the postData and colModel form my grid. This is how I got the params and put them into JS variables:

    var gParam = $("#grid").jqGrid('getGridParam','postData');
    var gParamCol = $("#grid").jqGrid('getGridParam','colModel');

Upvotes: 1

Related Questions