Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by Stevo on May 12, 2008 00:14
open dhtmlx forum
[GRID] How to catch "Incorrect XML" error?

Hello.

Probably a simple question - If during loading grid fed by xml I redirect browser to diffrent page, I got an error information pop up - "Error type: Load XML; Description: Incorrect XML". That is fine, but i would like to ignore this message and not display it. I tried catching all errors from initialization code, but it did not help :/

try{
grid_<%=random_id%> = new dhtmlXGridObject('gridbox_<%=random_id%>');

(.......)

grid_<%=random_id%>.init();

<% if options[:open_node] %>
grid_<%=random_id%>.loadXML("<%=options[:xml]%>",function(){
        grid_<%=random_id%>.showRow(<%= options[:open_node] %>)
        grid_<%=random_id%>.cells(<%= options[:open_node] %>,0).open();
        grid_<%=random_id%>.setSizes();
    });
<% else %>
grid_<%=random_id%>.loadXML("<%=options[:xml]%>");
<% end %>
}catch(err){ }
Answer posted by Support on May 12, 2008 02:20
You can use next code snippet

function myErrorHandler(type, desc, erData){
    //custom code can be placed here
    return false;
}
dhtmlxError.catchError("LoadXML", myErrorHandler);
Answer posted by Tom Ince on Jun 11, 2008 06:48
I cannot find this "catchError" function anywere, in the Docs or in the .js files.
Answer posted by Support on Jun 11, 2008 06:56
The function itself defined in dhtmlxcommon.js
It has not any special description in documentation, the only possible use-case - described above.