I need to send extra parameters, in addition to $data, to my custom column display function, but my code doesn’t work:
$col[“on_data_display”] = array(“display_field_dl($op_table)”,”App\Http\Controllers\GestCantController”,FALSE);
public function display_field_dl($data,$opertable)
Is there any way to do it? Thanks
To use callbacks in laravel controller, you need to pass second param as $this.
$e[“on_data_display”] = array(“display_field_dl”,$this,false);
And it only receives $data as function input. You can make $op_table variable as class member and access it inside display_field_dl using $this->op_table.
Hope it help.
To use member variable,
Refer this code: https://gist.github.com/749f9e975c1b583768a5aedf2d8c079f
Unlike grid on_insert event, in this case I’m not able to handle column on_data_display event.
When I replace:
$col[“on_data_display”] = array(“display_field_dl”,”App\Http\Controllers\GestCantController”,FALSE);
$col[“on_data_display”] = array(“display_field_dl”,$this,FALSE);
I got this error (json_encode_jsfunc):
Object of class App\Http\Controllers\GestCantController could not be converted to string
We are sorry that this post was not useful for you!
Let us improve this post!
Tell us how we can improve this post?