Server-side data, use length menu and show "All" with -1 ?

Server-side data, use length menu and show "All" with -1 ?

mgmg Posts: 47Questions: 0Answers: 0
edited January 2011 in General
In the length menu example, we see the options set as follows:
http://www.datatables.net/examples/advanced_init/length_menu.html

[code]
$('#example').dataTable( {
"aLengthMenu": [[10, 25, 50, -1], [10, 25, 50, "All"]]
} );
[/code]

Yet when I try this approach server-side, it fails when selecting "All".
Has anyone run across this issue before or familiar with
how to handle this scenario?

Replies

  • allanallan Posts: 63,542Questions: 1Answers: 10,476 Site admin
    Hi mg,

    'All' is a special case - what happens with all is (as the array above says) it will use -1 as the length to get, rather than a positive integer. As such the server-side script needs to take this into account. The default server-side processing script already does this with the line:

    [code]
    if ( isset( $_GET['iDisplayStart'] ) && $_GET['iDisplayLength'] != '-1' )
    [/code]
    This is the default script: http://www.datatables.net/development/server-side/php_mysql .

    Are you using that script or a different one? If a different one it will need to take the -1 into account.

    Regards,
    Allan
  • mgmg Posts: 47Questions: 0Answers: 0
    @Allan - thanks for pointing me in the right direction.
  • satishlksatishlk Posts: 5Questions: 0Answers: 0
    Hi ,
    This is satish i have problem with id numbers after deleting a row.Can Anyone help how to change id after delete of table
  • allanallan Posts: 63,542Questions: 1Answers: 10,476 Site admin
    Sure we can :-). However, how to that relate to this thread, which is more than a year old?

    Have a look through this post and open a new thread with your question: http://datatables.net/forums/discussion/9719/how-to-ask-for-help .

    Allan
This discussion has been closed.