Grid, SQL Query Error handling...


First - sorry for a poor ennglish, I’m from Poland.

I’ve gor a PRO version.

Mabye it will be a stupid question, but I search everywhere and can’t find answer for that simple case: I have a dhtmlGrid and lunch load method with a *.php file as a parameter. There I have a SQL query lunch by render_complex_sql. And if I get for example a sql syntax error, my grid keeps silent… no data, no response. How to handle that king of error to show user: Look, it’s SQL Syntax Error: .

Hope it’s readable :slight_smile:

You can use the next construct

dhtmlxError.catchError(“LoadXML”,function(type, name, data){
alert(“My error handler \n”+name+"\n Status:"+data[0].status);

here data[0] - ajax request object, you can get status and response text from it

Need to say, that connector do not output the error info to client side ( you really do not wantt to show the actual error messages to the end users ).
If you need to track the connector’s error - you can use enable_log command, that will log all error messages.

Thank you for your reply.

So, before I wrote, search a lot of ways, also this. But I affraid it isn’t work… Nothing happend:

  function myErrorHandler(type, desc, erData){
    alert("GOT IT!");
    return false;
  dhtmlxError.catchError("LoadXML", myErrorHandler);

  grid_1.load('data/xml_wszystkie_towary.php'); // here I've got a SQL Error from render_complex_sql

Sorry for inconvenience. The dhtmlxError handler will fire only if response from server side is invalid. In your case the error was catched by connector, and connector outputs to the client side the empty but still valid dataset.

To change behavior, add on server side, before render_ command

$grid->enable_log(“some.txt”, true);

It will enable both - logging the errors on server side, and output the log to client side, which will trigger dhtmlxError

Sorry, but still not working :frowning: Won’t catch the error. Mabye I put this function at wrong place? Is that important? Before grid.load, after?

But it’s helpfull what you said… - logging to text file (server side) work fine :slight_smile:

For now I’ve got response from server side start as (php file):

…error message…
Isn’t a valid DataSet? dhtmlxGrid waits for xml…

Thank you.

I can’t find a “edit post” option…

I still hope for your advice :wink:

Exactly the same code works for me

function myErrorHandler(type, desc, erData){ alert("GOT IT!"); return false; } dhtmlxError.catchError("LoadXML", myErrorHandler); mygrid.loadXML("01_basic_connector.php");

Actually, even without dhtmlxError line, you must see the alert with server side error details ( default dhtmlxError handler )

Which version of dhtmlx grid you are using ?
In case of 3.6 - please try to update dhtmlxcommon.js with the attached one. (6.96 KB)

I use 3.5 version. Unfortunately still no effect.
Additional, I use compiled version, dhtmlx.js from 3.5 version.
Mabye it’s saome configuration error? I’m using it at IIS 7.0 on Win2k3 and SQLSrv3.0.

Please try to use the attached dhtmlxcommon.js after dhtmlx.js but before any other dhtmlx files.

If issue still occurs - please open a ticket in the support system

Hmmm… Work like this… but it also empty dhtmlxWindow shows… weird. Do you know why?
Other way, I prefer to have a one dhtmlx.js file than seperate directories… byt after compilling not working…

No no :slight_smile: Sorry, this is my windows ofcourse :slight_smile:

But it’s still problem with pack all to one.

Please, open the ticket at and provide with the actual complete demo, a new compliled dhtmlx.js containing the fix will be provided to you.