PHP return a custom error to grid

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

The solution which you are using is correct. This code must stop any further processing and return a response with “error” status back to a client-side, where you can catch the response status and response text by using events of a dataprocessor

docs.dhtmlx.com/api__dataproces … event.html

Thank you for the reply but I am trying to return an error and stop PHP from rendering any data back to DataProcessor/Grid

Thank you