An easy way to do it is by using a parameter to your URL to be more specific you can simply have something like this:
function offices_management($more = null, $operation = null)
{
//This will simply redirect you from /demo/offices_management/1 to /demo/offices_management
if($more == "1" && $operation != "edit" && $operation != 'update')
redirect(strtolower(__CLASS__).'/'.strtolower(__FUNCTION__));
$crud = new grocery_CRUD();
$crud->set_table('offices');
...
if($more == '1')
$crud->fields('field_1','field2','field3',...);
else
$crud->fields('field_1','field2','field3',...);
$crud->add_action('More Details', '/images/more_details.png', 'demo/offices_management/1/edit');
$output = $crud->render();
$this->_example_output($output);
}
Ok I know when you will first see this hack you will say: "What the ....". So let me explain :
The :
$crud->add_action('More Details', '/images/more_details.png', 'demo/offices_management/1/edit');
is easy to understand that you will have urls like this: demo/offices_management/1/edit/345, demo/offices_management/1/edit/356, demo/offices_management/1/edit/357, ....e.t.c.
I really tried hard to make grocery CRUD work as a simple library so if you add for example: "demo/offices_management/1/edit/345" or "demo/offices_management/1/whatever/78/edit/345" or "demo/offices_management/1/89/78/edit/345" grocery CRUD auto-recognize that the only info that it is needed for the library is the "edit/345" . This is really useful to add parameters to the url as normal.
The most clever part is that grocery CRUD take all the parameters to the URL and follows you to all the operations. You can see a live example at:
http://www.grocerycr.../full_example/1 (I just add a 1 at the end of the URL), you will see that the 1 is been followed everywhere. To the add, to the edit , to the delete ...e.t.c. So that's why you will also need the:
if($more == "1" && $operation != "edit" && $operation != 'update')
redirect(strtolower(__CLASS__).'/'.strtolower(__FUNCTION__));
I hope I didn't make it complicated for you. Even if the answer is yes , you can simply copy-paste the code that I post to you