Getting access to filter text and which columns are sorted
Getting access to filter text and which columns are sorted
I have created a routine in our MVC applcation that exports data into an Excel file based on what is in the grid. The catch is that we are exporting more data than is showing in the grid. Our grid has 7 columns. Our Excel file has about 15. There just isn't room to display all of them on the screen.
A link is clicked in order for the export to take place. Basically we are rerunning the original query that loaded the grid when the link is clicked. This means that any sorting or filtering is ignored. Is there a way to grab what has been entered in the filter text box and also grab the columns that have been sorted on? This would allow us to use that information in our query when creating the Excel file. Hopefully this makes sense. Any help is appreciated. Thank you.
A link is clicked in order for the export to take place. Basically we are rerunning the original query that loaded the grid when the link is clicked. This means that any sorting or filtering is ignored. Is there a way to grab what has been entered in the filter text box and also grab the columns that have been sorted on? This would allow us to use that information in our query when creating the Excel file. Hopefully this makes sense. Any help is appreciated. Thank you.
This discussion has been closed.
Replies
Yes indeed - you can get this information from the DataTables settings object ( http://datatables.net/api#fnSettings ). These settings are internal, so not documented (have a peak at the code), but what you are looking for is: oPreviousSearch.sSearch and aaSorting.
Regards,
Allan