Quantcast
Channel: Recent Discussions — DataTables forums
Viewing all articles
Browse latest Browse all 82273

Updating the "Showing 1 to x of x entries" on server-side reload

$
0
0

My datatable is being initiated like so:

table = $('#liDetails-table').DataTable( {
  'processing'      : true,
  'serverSide'      : true,
  ajax :  {
   url: 'url.php',
   type : 'POST',
   data: { a:a,  li_row_limit:li_row_limit },
   dataSrc : 'aaData',
  },
  'columns'         : columns_list,
  'pageLength'      : li_row_limit,
});

When the page first loads, li_row_limit is set. However, I have a dropdown that allows the user to change the number of rows they see:

function recall_liDetails(data) {
  li_row_limit = data;
  table.ajax.reload(); // attempt 1
  table.draw(); //attempt 2
}

I'm attempting to update the li_row_limit variable before datatables does its POST to my php page, but I'm checking the $_POST on the php side and the variable is not updating.

How do I get this variable to update prior to a refresh, so the user can change the number of rows they see from a server-side processing point of view? I need both the POST as well as the datatables option `pageLength` to update....


Viewing all articles
Browse latest Browse all 82273

Trending Articles