DHTMLX Docs & Samples Explorer

Start and End of loading

Loading events occur when XML parsing starts and finishes. To test this functionality open/close nodes or refresh the tree (hardly detectable on fast connection)



Source
<link rel="STYLESHEET" type="text/css" href="../../codebase/dhtmlxtree.css">
<script  src="../../codebase/dhtmlxcommon.js"></script>
<script  src="../../codebase/dhtmlxtree.js"></script>
 
 
<table>
    <tr>
        <td valign="top">
            <div id="treeboxbox_tree" style="width:250px; height:218px;background-color:#f5f5f5;border :1px solid Silver;"></div>
        </td>
        <td rowspan="2" style="padding-left:25" valign="top">
            <input type="checkbox" id="a_1" checked> <label for="a_1">Show alerts for event</label><br>
            <div style="display:none" id="b_1"><h1 style="color:red">Loading</h1></div>
            <div style="display:none" id="b_2"><h1 style="color:green">Done</h1></div>                
        </td>
    </tr>
</table>
<br>
<script>
tree = new dhtmlXTreeObject("treeboxbox_tree", "100%", "100%", 0);
tree.setSkin('dhx_skyblue');
tree.setImagePath("../../codebase/imgs/csh_yellowbooks/");
tree.enableSmartXMLParsing(true);
tree.setOnLoadingStart(func_a);
tree.setOnLoadingEnd(func_b);
tree.loadXML("../common/tree.xml");
function func_a() {
    document.getElementById("b_1").style.display = "";
    document.getElementById("b_2").style.display = "none";
    if (document.getElementById("a_1").checked)
        alert("Loading start");
}
function func_b() {
    document.getElementById("b_2").style.display = "";
    document.getElementById("b_1").style.display = "none";
    if (document.getElementById("a_1").checked)
        alert("Loading end");
}
</script>