Well --- if you plan just to use the field to display the value and not store it .. then what u can do is .. use a callback_before_insert / Update and unset that field from the $post_array and return the same $post_array back from the function .. this should do the trick.. it wont add the new field to the table.
Exactly!
Function which I wrote in my first post works good (adds new column and data into it). But it's not a proper way to add new column I think.
Well Robert - you should look at here - i already have provided a patch u need to apply for the same issue
You mean that if I use 'callback_before_insert' searching and sorting will not work?
I've tried something like you wrote and it is not working (setting text to the column). The additional column is still empty.
function file()
{
$crud = new grocery_CRUD();
//$crud->set_theme('datatables');
$crud->set_table('upload');
$crud->order_by('date');
$crud->columns('title', 'filename', 'filepath', 'date');
$crud->display_as('title','Tytuł');
$crud->display_as('filename','Nazwa pliku');
$crud->display_as('filepath','Ścieżka');
$crud->display_as('date','Data i czas');
$crud->set_field_upload('filename','assets/uploads/files');
$crud->callback_before_insert(array($this,'filepath_callback'));
$output = $crud->render();
$this->_example_output($output);
}
public function _example_output($output = null)
{
$this->load->view('example.php', $output);
}
function filepath_callback($post_array)
{
$post_array['filepath'] = 'What next?';
return $post_array['filepath'];
}
Have the file been deleted when I pressed "delete row" button? Or should I try 'callback_after_deleteI and implement deleting file myself when the row is deleting