admin管理员组文章数量:1336367
I have a DataTables with server side processing. On server side I have functions retrieving filters from the ajax request and fetching data from database.
Now I want export data into excel file with filters.
I assume I have to design an excel file creator on server side and send the file through HTTP response.
I would like use already-defined functions to handle export request.
My question is: how can I send DataTables filter as same format as in the ajax request to my server ?
I have a DataTables with server side processing. On server side I have functions retrieving filters from the ajax request and fetching data from database.
Now I want export data into excel file with filters.
I assume I have to design an excel file creator on server side and send the file through HTTP response.
I would like use already-defined functions to handle export request.
My question is: how can I send DataTables filter as same format as in the ajax request to my server ?
Share Improve this question asked Aug 14, 2015 at 15:36 ZxcvZxcv 1,7472 gold badges16 silver badges23 bronze badges 01 Answer
Reset to default 6SOLUTION
You can use ajax.params()
to get the data submitted by DataTables to the server in the last Ajax request.
Then you can redirect to script that generates Excel file with these parameters using jQuery helper function $.param
that converts array into query string.
For example:
window.location = '/getFile.php?' + $.param($('#example').DataTable().ajax.params());
where example
is table ID.
NOTES
There is also TableTools extension with Download button but with recent jQuery DataTables 1.10.8 release, TableTools extension is now deprecated.
本文标签: javascriptServer side excel export with DataTableStack Overflow
版权声明:本文标题:javascript - Server side excel export with DataTable - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1742405634a2468761.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论