tonytomov / jqGrid

jQuery grid plugin
www.trirand.com
2.84k stars 1.2k forks source link

add support for string functions #1067

Closed biggeektx closed 2 months ago

biggeektx commented 2 months ago

Setting onClose within the setNavOptions in a PHP back end similar to:

$grid_excs->setNavOptions('edit', array("closeAfterEdit" => true, "width" => 900, "height" => 500, "dataheight" => 400, "closeOnEscape" => false, "onClose" => "testClose"));

... will result in PHP returning the function name as a string which will result in the error: TypeError: o.onClose.call is not a function

This update will parse that function name along with any namespace such as MyApp.testClose, execute it and return the result of the function.

tonytomov commented 2 months ago

I see you use our Guriddo PHP.

I think you missed some docs.

In this case you can call this function two ways:

Fist

$grid_excs->setNavOptions('edit', 
    array("closeAfterEdit" => true, 
              "width" => 900, 
              "height" => 500, 
              "dataheight" => 400, 
              "closeOnEscape" => false, 
              "onClose" => "js:testClose"
));

or just use setNavEvent without js: prefix

$grid_excs->setNavEvent('edit', "onClose", "testClose");

More on this you can see here:

Writing JavaScript Grid Events