jquery - How to export all rows from Datatables using Ajax? -


i using new feature in datatables: "html5 export buttons". loading data ajax.

https://datatables.net/extensions/buttons/examples/html5/simple.html

the problem export page displayed.

i exporting this:

buttons: [     {         extend: 'pdfhtml5',         text: 'pdf',         exportoptions: {             "columns": ':visible',         }     }, ] 

how can export rows?

according datatables documentation there no way export rows when using server side:

special note on server-side processing: when using datatables in server-side processing mode (serverside) selector-modifier has little effect on rows selected since processing (ordering, search etc) performed @ server. therefore, rows exist on client-side shown in table @ 1 time, , selector can select rows on current page.

i worked around adding 'all' parameter length menu , training end users display records before doing pdf (or xls) export:

var table = $('#example').datatable({     serverside: true,     ajax: "/your_ajax_url/",     lengthmenu: [[25, 100, -1], [25, 100, "all"]],     pagelength: 25,     buttons: [         {             extend: 'excel',             text: '<span class="fa fa-file-excel-o"></span> excel export',             exportoptions: {                 modifier: {                     search: 'applied',                     order: 'applied'                 }             }         }     ],     // other options }); 

Comments

Popular posts from this blog

java - Date formats difference between yyyy-MM-dd'T'HH:mm:ss and yyyy-MM-dd'T'HH:mm:ssXXX -

c# - Get rid of xmlns attribute when adding node to existing xml -