Setting default value for show entries not working

Setting default value for show entries not working

arturECarturEC Posts: 9Questions: 4Answers: 0

Hello,

I am trying to change the default value of entries that are shown in the datatable.

Following this example and the StackOverflow post here, I have this code in my datatable initialisation:

table = $('#tbl_leader_board').DataTable( {
   stateSave: true,
   "bFilter" : true,
    "responsive" : true,
    "aLengthMenu": [[ 50, 75, -1], [ 50, 75, "All"]],
    "iDisplayLength": 50,
    "order": [[ 7, "desc" ]]
});

However, when I try to run this code, it puts blank in the space of the number of entries to show. Is there another way to achieve this?

Answers

  • kthorngrenkthorngren Posts: 21,303Questions: 26Answers: 4,947

    I copied your code here and it seems to work (it shows 50 in the page length option):
    http://live.datatables.net/hewenaza/1/edit

    Maybe you can add to the test case to replicate the problem.

    Kevin

  • arturECarturEC Posts: 9Questions: 4Answers: 0

    Actually I think it is working. I have a stateSave option on all my tables. Am I correct in saying that it remembers the selected show entries, and that's why its causing some bugs?

This discussion has been closed.