javascript - jQuery Datatables: iDisplayLength set to -1 to show all rows - Stack Overflow

I use jQuery Datatables and want to listen a Table with all my entries via ajax from a server. Everythi

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 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?

Share Improve this question edited Jun 24, 2013 at 9:13 Sylnois asked Jun 24, 2013 at 9:04 SylnoisSylnois 1,6316 gold badges26 silver badges51 bronze badges 2
  • What about this : stackoverflow./questions/9443773/… ? – LMeyer Commented Jun 24, 2013 at 9:34
  • @Shinosha He just add aLengthMenu, and i don't need that. In the next step, i want to disable Pagination("bPaginatie": false). – Sylnois Commented Jun 24, 2013 at 9:43
Add a ment  | 

1 Answer 1

Reset to default 2

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

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1744086335a4556245.html

相关推荐

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信