[ANSWERED] How can I pass custom data to callback?
- Single Page
Posted 24 May 2012 - 19:24 PM
Throughout my application I want to be able to log each CRUD and thought I could do that with callbacks before insert, etc.
My problem is in how to transfer descriptor data to the call back function. This is probably easily accomplished, I just can't figure out how.
Thanks for the advice.
Chris
Posted 28 May 2012 - 08:45 AM
Posted 28 May 2012 - 19:21 PM
Posted 04 June 2012 - 23:18 PM
Posted 03 April 2014 - 16:05 PM
hi johnny,
i tried the session method, but it seems that when i clicked the EDIT button, the session is not captured on the first time,when I refresh the page again, then it will captured the session.
Posted 29 October 2015 - 16:38 PM
class Admin_model extends CI_Model { private $variable_to_pass; public function products() { $this->variable_to_pass = 123; $crud = new grocery_CRUD(); $crud->callback_after_insert(array($this, 'my_callback')); .... return $output; } function my_callback($post_array,$primary_key) { $this->db ->where('id', $primary_key) ->update('products', array('foo' => $this->variable_to_pass)); return true; }
worked for me.
Posted 28 March 2016 - 07:27 AM
$crud->set_relation('province_id','province','province_name'); $crud->set_relation('city_id', 'city', 'city_name'); $crud->display_as('provi_id','Province'); $crud->display_as('city_id','City');
How to auto insert the longitude and latitude when selecting city??