Hi,
I’m new in DHTMLX and i want to make a timing of my tree load.
To do this, i attached an event before and after the loadXML method.
in order to timing the display, i use the microtime type.
when i compile my code the afterEvent compile before the loadXML and not after.
Here my code :
<head>
<script src="dhtmlxcommon.js"></script>
<script src="dhtmlxtree.js"></script>
<script src="dhtmlxtree_srnd.js"></script>
<script src="datetime.min.js"></script> <!-- for microtime type-->
</head>
<body onload="doOnLoad()">
<h1>Tree Component</h1>
<form name="chrono">
<input type="text" size="20" name="total"> tps Total
<br/>
<input type="text" size="20" name="start"> Start
<br/>
<input type="text" size="20" name="end"> End
</form>
<div id="treebox1" style="width:250px; height:218px;background-color:#f5f5f5;border :1px solid Silver;; overflow:auto;"/>
<script>
var tree1;
var $chronoEnd;
var $chronoStart;
function doOnLoad(){
tree1 = new dhtmlXTreeObject(document.getElementById('treebox1'),"100%","100%",0);
tree1.setImagePath("codebase/imgs/");
tree1.setSkin('dhx_skyblue');
tree1.attachEvent("onXLS",getTimeStart());
tree1.attachEvent("onXLE",getTimeEnd($chronoStart));
tree1.enableSmartXMLParsing(true);
tree1.loadXML("codebase/bdd/big_xml.xml");
function getTimeStart(){
$chronoStart = microtime(true);
document.chrono.start.value=""+$chronoStart;
}
function getTimeEnd($start){
$chronoEnd = microtime(true);
$cd=$chronoEnd - $start;
document.chrono.total.value=""+$cd;
document.chrono.end.value=""+$chronoEnd;
}
}
</script>
</body>
If someone has an idea ?
Thanks.