callback_column example

function example_callback_column(){
    $crud = new grocery_CRUD();
 
    $crud->set_table('products');
    $crud->set_subject('Product');
    $crud->unset_columns('productDescription','productScale');
    $crud->callback_column('buyPrice',array($this,'valueToEuro'));
    $crud->callback_column('quantityInStock',array($this,'product_scale_callback'));
 
    $output = $crud->render();
 
    $this->_example_output($output);
}
 
function valueToEuro($value, $row)
{
    return $value.' €';
}
 
function product_scale_callback($value, $row)
{
    return $value." - scale: <b>".$row->productScale."</b>";
}
Note: The below example is an iframe so it might appeared with a scroll bar. If you like you can view the example on a new tab