Custom records per page on controller?

Hi,
looking around there are various questions about expanding the displayed results by setting

$config[‘grocery_crud_default_per_page’] = 25

Would it be possible to set a different limit for a single controller ? eg all pages still use the config setting in

config/grocery_crud.php

but specify a different value for a single controller .

thanks

Hello

Up to a point, yeah

In the grocery_crud.php (config).
you would have to create in the array all the quantities in the list of your view
default
$ config [‘grocery_crud_paging_options’] = array (‘10’, ‘25’, ‘50’, ‘100’);

example
$ config [‘grocery_crud_paging_options’] = array (‘10’, ‘18’, ‘25’, ‘50’, ‘100’);

then on the controller the simple magic of Grocery CRUD
$ this-> config-> load (‘grocery_crud’);
$ this-> config-> set_item (‘grocery_crud_default_per_page’, ‘18’);

Important this applies easily with no-flexigrid
$ crud-> set_theme (‘no-flexigrid’);

I recommend you too
$ crud-> getStateInfo ();
$ crud-> getState ();

$ state_info = $ crud-> getStateInfo ();
$ operation = $ crud-> getState ();
if ($ operation == ‘add’ || $ operation == ‘insert’ || $ operation == ‘insert_validation’) {

} elseif ($ operation == ‘edit’ || $ operation == ‘update’ || $ operation == ‘update_validation’) {

} else {
$ this-> config-> load (‘grocery_crud’);
$ this-> config-> set_item (‘grocery_crud_default_per_page’, ‘18’);
}

for datatables you could touch something in its view of the themes
list.php

This was discussed here but there were no answers
Custom records per page on controller?

But here there were a couple of comments
Config

Applicable to Grocery CRUD 1.6.4

It’s who I work with

Sorry about the English text but I use google translator
Lucky

1 Like