Doubt about deferRender in ajax calls
Doubt about deferRender in ajax calls
Tiago Azevedo Borges
Posts: 11Questions: 2Answers: 0
I have a question, if the deferRender option is false, should the DataTables create all the HTML elements, even if the serverSide option is true?
Should not the pageSize be ignored when deferRender is false?
My intention is to be able to use the print button and pick up all the items of the call and not just those that are being shown in the table.
My code:
$(function () {
var table = $('#dataTable').DataTable({
serverSide: true,
deferRender: false,
ajax: {
'url': '@Url.Action("List", "Consignataria")',
'error': function(xhr, textStatus, error) {
alert(error);
}
},
lengthMenu: [[5, 10, 25, 50, -1], [5, 10, 25, 50, "All"]],
buttons: ["print"],
columns: [
{ 'data': 'Id', 'name': 'Id', 'autoWidth': true },
{ 'data': 'Name', 'name': 'Name', 'autoWidth': true },
{ 'data': 'Number', 'name': 'Number', 'autoWidth': true }
],
initComplete: function () {
var api = this.api();
api.buttons().container().appendTo($("#table-actions"));
}
});
});
This question has an accepted answers - jump to answer
This discussion has been closed.
Answers
See the "How can I export the whole table when using serverSide and Buttons." FAQ in this section:
https://datatables.net/faqs/index#Server-side-processing
How rows do you have total in your table? Maybe you don't need server side processing enabled. The export buttons only pickup the data in the client.
Kevin
I would like to take advantage of the filter, ordernation, etc. of DataTables on exporting but taking the content of all the pages.
We could have a way to create a temporary data source to use for export.
But anyway thank you.
No.
deferRender
is basically irrelevant whenserverSide
is enabled, since server-side processing will only request the data for the current page.No. Use
paging
if you want to disable paging. Also consider that if you have server-side processing enabled, it is pointless to disable paging since you'd be loading the entire data set on every draw. You wouldn't be getting any performance benefit and would only be introducing network latency.Allan