DHTMLX Docs & Samples Explorer

Custom error handlers

The current sample demonstrates how custom errors notifications look like. You can ealisy set the error handler using the code mentioned below.



Source
 
    <link rel="STYLESHEET" type="text/css" href="../../codebase/dhtmlxtree.css">
<script  src="../../codebase/dhtmlxcommon.js"></script>
<script  src="../../codebase/dhtmlxtree.js"></script>    
<script src="../../codebase/ext/dhtmlxtree_er.js" type="text/javascript"></script> 
<table>
    <tr>
        <td>
            <div id="treeboxbox_tree" style="width:250px; height:218px;background-color:#f5f5f5;border :1px solid Silver;"/>
        </td>
        <td rowspan="2" style="padding-left:25" valign="top">
        </td>
    </tr>
    <tr>
        <td></td>
    </tr>
</table>
<script>
function my_error_handler(type, name, data) {
    if (type == "LoadXML");
    alert("My error handler \n" + name + "\n Status:" + data[0].status);
}
dhtmlxError.catchError("LoadXML", my_error_handler);
dhtmlxError.catchError("DataStructure", my_error_handler);
tree = new dhtmlXTreeObject("treeboxbox_tree", "100%", "100%", 0);
 
tree.setSkin('dhx_skyblue');
tree.setImagePath("../../codebase/imgs/");
tree.loadXML("incorrect.xml");
</script> <br><br>