robinvanderknaap / MvcJqGrid

Fluent jqGrid Html Helper for ASP.NET MVC
www.playground.webpirates.nl/mvcjqgrid
GNU Lesser General Public License v3.0
101 stars 74 forks source link

Export to CSV #16

Open ghost opened 11 years ago

ghost commented 11 years ago

How difficult would it be to add something that would make an ajax call with the search parameters to allow us to get the data that is currently displayed and export it to a CSV?

Basically offering a button on the grid itself that can gather any of the search criteria to allow us to make a call grab data and build a csv file available for download to the user.

So more or less just an ajax call that is akin to the SetUrl call that is tied to a button in the grid? Is there a way I can add something like this myself in JavaScript and grab the grid's search parameters.

daanl commented 11 years ago

mbraunwart this is more a jqgrid question rather then the helper question.

But to get you started code below shows you how to add an button the grid, then you can just call getGridParam('postData') to get the post data in the object you will find the search parameters, using an ajax call or just location.href =

   jQuery("#grid").jqGrid('navButtonAdd','#pager',{
       caption:"", 
       onClickButton : function () { 

       } 
});