I want to ask about function that can make auto calculation in grocery crud.
For example: I have some column a, b, and total_a_b. I have used function callback_column but its now work perfectly, callback_column just show the result on the view page and it can't auto save to database. What the function that can refer it? And whether there are a way to show that calculation automatic in field form?
This is my code:
public function try() {
$crud = new grocery_CRUD();
$crud->set_table('try');
$crud->columns('a', 'b', 'total');
$crud->callback_column('total', array($this, '_callback_column_total'));
$output = $crud->render();
$this->_example_output($output);
}
public function _callback_column_total ($value, $row) {
$a = $row->a;
$b = $row->b;
$total=$a + $b;
return $total;
}