datatable severside issue
datatable severside issue
RameshM2911
Posts: 1Questions: 0Answers: 0
hi, guys,,
let table = $('myid')
.DataTable(
{
"lengthMenu": [[5, 10, 25, 50, 100], [5, 10, 25, 50, 100]],
"processing": true,
"serverSide": true,
"pageLength": 5,
"ajax": {
"url": "/url,
"data": function(data) {
// process data before sent to server.
}
},
responsive: true,
orderCellsTop: true,
colReorder: true,
scrollCollapse: true,
fixedHeader: true,
// fixedColumns:
// {
// leftColumns: 1
// },
dom:
/*
* --- Layout Structure --- Options l - length changing
* input control f - filtering input t - The table! i -
* Table information summary p - pagination control r -
* processing display element B - buttons R - ColReorder
* S - Select
*
* --- Markup < and > - div element <"class" and > - div
* with a class <"#id" and > - div with an ID
* <"#id.class" and > - div with an ID and a class
*
* --- Further reading
* https://datatables.net/reference/option/dom
* --------------------------------------
*/
"<'row mb-3'<'col-sm-12 col-md-6 d-flex align-items-center justify-content-start'f><'col-sm-12 col-md-6 d-flex align-items-center justify-content-end'B>>" +
"<'row'<'col-sm-12'tr>>" +
"<'row mt-2'<'col-sm-12 col-md-4'i><'col-sm-12 col-md-4'l><'col-sm-12 col-md-4'p>>",
buttons: [{
extend: 'colvis',
text: 'Column Visibility',
titleAttr: 'Col visibility',
className: 'btn-outline-default'
}, {
extend: 'csvHtml5',
text: 'CSV',
titleAttr: 'Generate CSV',
className: 'btn-outline-default'
}, {
extend: 'copyHtml5',
text: 'Copy',
titleAttr: 'Copy to clipboard',
className: 'btn-outline-default'
}, {
extend: 'print',
text: 'Print',
titleAttr: 'Print Table',
className: 'btn-outline-default'
}],
"columns": [{
"data": "id",
"name": "ID",
"title": "ID"
}, {
"data": "column 1",
"name": "column 1",
"title": "column 1",
defaultContent: "-"
}, {
"data": "column 2",
"name": "column 2",
"title": "column 2",
defaultContent: "-"
}, {
"data": "column 3",
"name": "column 3",
"title": "column 3",
defaultContent: "-"
}, {
"data": "column 4",
"name": "column 4",
"title": "column 4",
defaultContent: "-"
}]
});
how to solve this error
1 - Showing 0 to 0 of 0 entries (filtered from NaN total entries)
2- pagination number 1,2,3,4, so on
my issue is when no record in data table why see this error in front end screen table 1,2
please help this serverside issue
thanks,
Edited by Colin - Syntax highlighting. Details on how to highlight code using markdown can be found in this guide.
This discussion has been closed.
Replies
Because you've enabled
serverSide
, it's upto the server-side script to return that info. The protocol is discussed here. Also see examples here.Cheers,
Colin