⚠ In case you've missed it, we have migrated to our new website, with a brand new forum. For more details about the migration you can read our blog post for website migration. This is an archived forum. ⚠

  •     

profile picture

Custom Columns - Callback



Varitius
  • profile picture
  • Member

Posted 25 July 2018 - 11:59 AM

Hey,

 

So I have custom columns defined with $crud->columns() that use the dates

$crud->columns('sName',$date->format('d-m-Y'),$date->modify('+1 weeks')->format('d-m-Y'));

I then want to run a callback on the custom columns, 

$crud->callback_column($date->format('d-m-Y'),array($this,'_test'));

Which works perfectly, however, I need to try and capture the column header somehow and I can't figure out how. 

 

Essentially, I want to cross-reference the column header (date) to see if there is a record in the database that corresponds to that date and matches sName, I can do this fine. I just can't seem to get my head around being able to read the column header in the callback function. 

Any ideas? :)

 

Thanks,

Vari 


Varitius
  • profile picture
  • Member

Posted 25 July 2018 - 12:14 PM

I amended line 1867 to

$list[$num_row]->$field_name = call_user_func($this->callback_column[$field_name], $field_value, $row, $column->field_name);

This allowed me to access the additional value from the callback function :)