⚠ 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

Adding "All" option to items_per_page



DrPaul
  • profile picture
  • Member

Posted 04 June 2014 - 18:39 PM

When in the flexigrid list view, I thought it would be nice to have "All" as one of the options in the items_per_page drop-down.

 

Here's how I did it by hacking one line of code in list_template.php.

 

In config/grocery_crud.php add an option of a million items per page, for example:

 

$config['grocery_crud_paging_options'] = array('10','20','50','100', '1000000');
 

Then around line 139 of assets/grocery_crud/themes/flexigrid/views/list_template.php change

 

<option value="<?php echo $option; ?>" <?php if($option == $default_per_page){?>selected="selected"<?php }?>><?php echo $option; ?>&nbsp;&nbsp;</option>
 

to

 

<option value="<?php echo $option; ?>" <?php if($option == $default_per_page){?>selected="selected"<?php }?>><?php if($option == 1000000){ echo 'All'; } else { echo $option; } ?>&nbsp;&nbsp;</option>
 

It's not elegant, but it adds just a bit more functionality to GC.