jquery DataTables plugin: Server-side data, use length menu and show "All" with -1?
In the length menu example, we see the options set as follows: http://www.datatables.net/examples/advanced_init/length_menu.html
$('#example').dataTable( {
"aLengthMenu": [[10, 25, 50, -1], [10, 25, 50, "All"]]
});
Yet when I try this approach server-side, it fails when selecting "All". Has开发者_Python百科 anyone run across this issue before or familiar with how to handle this scenario?
it will be better if you post your question in dataTable forum...there you will get more response..here is link for that DataTable Forum
you can try something like this also...
$(document).ready(function() {
$('#example').dataTable( {
"oLanguage": {
"sLengthMenu": 'Display <select><option value="10">10</option>
<option value="20">20</option>
<option value="30">30</option>
<option value="40">40</option>
<option value="50">50</option>
<option value="-1">All</option>
</select> records'
}
} );
} );
The question was answered on the datatables forum.
The "-1" can be thought of as a "dummy" value that needs to be processed server-side. (pseudo-code: if @numberofrows = -1, then select all)
http://datatables.net/forums/comments.php?DiscussionID=3959&page=1#Comment_16445
精彩评论