Server side pagination using limit 10 or 25
Server side pagination using limit 10 or 25
patelhiten99
Posts: 1Questions: 0Answers: 0
How to add Server Side Pagination in this function, using per page limit 10 or 25
$('#example1').DataTable({
"columnDefs": [
{ "visible": false, "targets": 1 }
],
"order": [[ 0, 'asc' ]],
"displayLength": 10,
"drawCallback": function ( settings ) {
var api = this.api();
var rows = api.rows( {page:'current'} ).nodes();
var last=null;
api.column(1, {page:'current'} ).data().each( function ( group, i ) {
if ( last !== group ) {
$(rows).eq( i ).before(
'<tr style="background-color: #e5e7e9 ; color:black;font-weight:bold "><td colspan="6">'+group+'</td></tr>'
);
last = group;
}
});
}
});
This discussion has been closed.
Replies
Does your server-side currently implement server-side processing? I don't see either the
ajax
orserverSide
parameters in your code.Allan
Hi allan, I have implemented django-mysql datatable serverside which is editable edit functionality is working fine but searching, sorting and pagination is not working
Hi @aditya14p ,
Is that using Editor? We're happy to take a look, but as per the forum rules, please link to a test case - a test case that replicates the issue will ensure you'll get a quick and accurate response. Information on how to create a test case (if you aren't able to link to the page you are working on) is available here.
Cheers,
Colin
@colin no editor is not using
following I tried to create example but how it will show data it is using localhost api to fetch data http://live.datatables.net/kahepabe/1/
Please help
@colin Detailed question is here
https://datatables.net/forums/discussion/56174/searching-sorting-and-pagination-not-working-in-server-side-datatable#latest