Force error on Grid Load from PHP


#1

Hello,

I am trying to force an error to grid from PHP connector before executing the select statement.

Is there any way to simply return some JSON/XML/String or anything else from PHP which would tell the grid that an error occured and display a message in the browser?

Here is my last attempt:

function mySelect($action){
    $action->set_response_text("error"); 
    $action->invalid();
}

$gridConn->event->attach("beforeProcessing","mySelect");

Nothing happens and the data is loaded to the grid normally.

Thank you


#2

Yep, sure.
The code which you are using is mostly valid. Calling $action->invalid() must block any further processing and must return the text message back to client side, where you can catch the action with dataprocessor’s event

docs.webix.com/api__dataprocess … event.html