Please let me know how can i change the Page Length Dynamically??
Please let me know how can i change the Page Length Dynamically??
For Example if I have less than 500 rows then show All or if i have more than 500 rows then change the default page length to 500.
$(document).ready(function() {
var table = $('#nodeCardConfigurationTable').DataTable( {
"rowsGroup" : [0,1,9,2,8,3,7,4,6],
"columnDefs" : [ { orderable: false, targets: [1,2,3,4,5,6,7,8,9] } ],
"dom" : '<flp <t> i>',
"lengthMenu": [[-1, 500, 1000, 2000], ["All", 500, 1000, 2000 ]],
"drawCallback": function( settings ) {
}
} );
} );
how can i do it in drawCallBack or is there is any other way?
Answers
You can use the
page.len()
to set the page length.Kevin
Thanks Kthorngren.. As i am new to datatables i have few more queries
Please let me know how can i access page.len() in the drawCallBack function???
And how can i get the total number of rows in drawCallBack ??
This is documented in the
drawCallback
reference documentation. See the example.page.info()
. The full API documentation is available here.Allan