⚠ In case you've missed it, we have migrated to our new website, with a brand new forum. For more details about the migration you can read our blog post for website migration. This is an archived forum. ⚠

  •     

profile picture

Changing paging options - datatables theme



possibleworlds
  • profile picture
  • Member

Posted 27 May 2012 - 10:57 AM

Hello,

Thanks so much for grocery CRUD, I'm enjoying getting started with it.

I'm trying to change the paging options to include more than 100 rows... if I add additional options to $data->paging_options in libraries/grocery_crud.php they show up in the flexigrid theme but not in the datatables theme.

What do I need to change to get datatables to show more paging options?

web-johnny
  • profile picture
  • Administrator
  • 1,166 posts

Posted 27 May 2012 - 11:25 AM

A work around for this is:

You can go to: assets/grocery_crud/themes/datatables/js/datatables.js and add something similar to this:


"aLengthMenu": [[10, 25, 50, 100, 200, -1], [10, 25, 50, 100, 200, "All"]]


so for example your code will be:


var default_per_page = typeof default_per_page !== 'undefined' ? default_per_page : 25;
$(document).ready(function() {
oTable = $('#groceryCrudTable').dataTable({
"bJQueryUI": true,
"sPaginationType": "full_numbers",
"bStateSave": true,
"aLengthMenu": [[10, 25, 50, 100, 200, -1], [10, 25, 50, 100, 200, "All"]],
"iDisplayLength": default_per_page,
.....


For more about aLengthMenu you can go strait away to : http://datatables.ne...ength_menu.html

The $data->paging_options is only available for flexigrid theme now but I will add an issue to have it to datatables also.