I use jQuery Datatables and want to listen a Table with all my entries via ajax from a server. Everything works perfectly. I mean, i get the data and can show them in the table. I got only one problem. I want to show all rows/entries at once. I've googled and all say, that i just have to set the iDisplayLength to -1. But if I do that, i got only 1 entrie/row(Showing 1 of 1 of totally 50 entries). Any idea what i'm doing wrong? This is my code to initialize the table:
var oTable = $("#roles").dataTable({
"bServerSide" : true,
"sAjaxSource" : "/data",
"iDisplayLength" : -1,
"aoSearchCols:" ["sSearch" : initiator], null, null, null, null, null, null],
"fnServerParams" : function(aoData){
aoData.push({"name": "sLDAPQuery", "value": "roles"});
}
});
edit: It works, if I set iDisplayLength for example to 1'000, but what if I get more than 1'000 rows?
I think you first get how many records you are having in the database than dynamically add the length dynamically using fnLengthChange
Please click on fnLengthChange. It will show you the example. May it helps you
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With