⚠ 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

set_relation and callbacks don't work



saulimus

saulimus
  • profile picture
  • Member

Posted 07 September 2012 - 12:01 PM

If I try to use a callback with a column (haven't tried a field yet) that has a relation, the callback doesn't work.
Add the following lines to the GC 1.3.1 examples controller to see the bug in action:

function employees_management()
{
...
$crud->callback_column('officeCode', array($this, '_callback_test'));
...
}

function _callback_test($value, $row)
{
return 'test';
}


You can easily see that it should work by uncommenting the set_relation('officeCode'...) line.

Update:
Array $this->callback_column includes 'officeCode' but function change_list() is looking for the unique field value like 'se95a0e4e'... because get_columns() has changed the field name to the unique value.

mikelamar

mikelamar
  • profile picture
  • Member

Posted 07 September 2012 - 15:05 PM

I also had a similar problem and this post helped me fix this

saulimus

saulimus
  • profile picture
  • Member

Posted 07 September 2012 - 15:59 PM

I actually used that fix before but I think it's better to fix it for good as it's a nasty bug.