Here code in controller
$crud = new grocery_CRUD();
$crud->set_theme('datatables');
$crud->where('HeaderId', $headerid);
$crud->set_table('trpurchasingdetail');
$crud->field_type('HeaderId', 'hidden' , $headerid)
->field_type('Total', 'invisible');
$crud->set_relation('productId', 'msproduct', 'productName');
$crud->set_subject('Price');
$crud->display_as('PriceCurrency', 'Price')
->display_as('productId', 'Product Name')
->display_as('DetailRemarks', 'Detail Product')
->display_as('UnitType', 'U/M');
$crud->fields('PriceCurrency','Qty');
$crud->unset_columns('HeaderId')
->unset_add()
->unset_delete()
->unset_print()
->unset_export();
$crud->callback_before_update(array($this->transaction, 'totalPrice'));
$output = $crud->render();
$output->hasil = $this->db->query("SELECT Number FROM trpurchasingheader
WHERE Id = '$headerid'")->row();
$output->type = "Order No";
$output->link = "index.php/purchasing/transaction";
$output->direct = "Purchasing List";
$this->load->view('listproduct', $output);
And this the function that will be called before update
function totalPrice($post_array, $primary_key) {
$harga = $post_array['PriceCurrency'];
$qty = $post_array['Qty'];
$post_array['Total'] = $harga * $qty;
return $post_array;
}
I've try this function with callback_before_insert and it works perfectly, but when I use this function with callback_before_update it not return any value.
Sorry for my bad english
SOLVED Sorry