⚠ 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

Config



DrCorduroy
  • profile picture
  • Member

Posted 31 January 2013 - 19:18 PM

Is this or something similar possible?

$config['grocery_crud_default_per_page'] = 10;
$output = $crud->render($config);

Or is the only place the config can be changed is in the config file itself? I want to be able to change the default per page with the different instances of grocery crud.

victor
  • profile picture
  • Member

Posted 31 January 2013 - 19:35 PM

you can try this:



$this->config->load('grocery_crud');
$this->config->set_item('grocery_crud_default_per_page', '100');

$crud = new grocery_CRUD();
// ........


but you can use only '10', '25', '50', '100'.
because there is one line in the library which contain it:

$data->paging_options = array('10', '25', '50', '100');
You can change it as you like.

DrCorduroy
  • profile picture
  • Member

Posted 31 January 2013 - 19:52 PM

That worked, thanks.

I see I ran into this issue because of a lack of knowledge of the codeignitor config class.

davidoster
  • profile picture
  • Member

Posted 31 January 2013 - 20:01 PM

The configuration that [member='victor'] showed you before is application specific. This means that this a special configuration that comes with the grocery_crud library. CodeIgniter makes it easy to have such items in a configuration file for our application.
Just have a look under /application/config. There are numerous files that hold the configuration of your application.
Check the file /application/config/grocery_crud.php for the specific configuration about grocery_crud.
And here: http://ellislab.com/codeigniter/user-guide/libraries/config.html all the details about the CI's Config class.