on_data_display extra parameters

Questionson_data_display extra parameters
gianluca asked 4 years ago

Hi Abu,

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
4 Answers
Abu Ghufran Staff answered 4 years ago

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.

_________________________
Abu Ghufran - Dev Team
Grid 4 PHP Framework
 
Abu Ghufran Staff answered 4 years ago

To use member variable,

Refer this code: https://gist.github.com/749f9e975c1b583768a5aedf2d8c079f

Line 16,47,86

_________________________
Abu Ghufran - Dev Team
Grid 4 PHP Framework
 
gianluca answered 4 years ago

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);

with:

$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

C:\xampp\htdocs\sigesc\app\Classes\phpgrid\jqgrid_dist.php:8121

Abu Ghufran Staff answered 4 years ago

Ok, i will test it. You can continue using complete class name instead of $this.

_________________________
Abu Ghufran - Dev Team
Grid 4 PHP Framework
 
Your Answer

10 + 5 =

Login with your Social Id:

OR, enter

Attach code here and paste link in question.
Attach screenshot here and paste link in question.



How useful was this discussion?

Click on a star to rate it!

Average rating 0 / 5. Vote count: 0

No votes so far! Be the first to rate it.

We are sorry that this post was not useful for you!

Let us improve this post!

Tell us how we can improve this post?