I can get the code to work for states 'edit' and 'delete". However trying to trigger on an insert (wheb a new record is added) or when an update (to an existing record is made - presuming this is after you push "update" on an edit record), does not appear to work. I am unable to get into the state = insert or update clause.
What triggers these states or is something wrong with the construction of the code?
Thanks!
$output = $this->grocery_crud->render(); $state = $this->grocery_crud->getState(); $state_info = $this->grocery_crud->getStateInfo(); xdebug_break(); if (($state == 'edit') || ($state == 'delete')) { $this->unsetChinaCompany($state_info->primary_key); //set to false } elseif (($state == 'insert') || ($state == 'update')) { // even just putting a die in here doesn't work //die(); $this->setChinaCompany($state_info->primary_key); //set to true } $this->_example_output($output); }