How to access the grid values in a callback function?
- Single Page
Posted 09 December 2011 - 15:47 PM
I have used add/edit callbacks and am able to change the controls but am not sure how to access the values available in the grid - must be a childish question please bear with me.
TIA
Posted 09 December 2011 - 19:39 PM
I want to conditionally make certain controls on the [edit] form `read only` based on a certain value of the record, when edit form is invoked from the grid - am using datatables. I am not sure how can I retrieve and use the values of the current record?
I have used add/edit callbacks and am able to change the controls but am not sure how to access the values available in the grid - must be a childish question please bear with me.
TIA
[/quote]
It's not a childish question. It's actually my fault that I don't have enough documentation. It is just the second parameter of your callback . So in the example
http://www.grocerycrud.com/crud/example/callback_edit_field You can have something like this
function edit_field_callback_1($value, $primary_key)
{
$this->db->where('customer_id',$primary_key);
$result = $this->db->get('your_table')->row();
return '<input type="text" name="phone" value="'.$result->your_field.'" />'
}
Posted 09 December 2011 - 22:30 PM