Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by Rory Gilleran on Dec 08, 2008 19:49
open dhtmlx forum
Tree.onClick event

Hi,
I have a tree on my page, constructed and populated as follows:

function doInitTree() {
tvHistory = new dhtmlXTreeObject(document.getElementById('tvHistory_container'), "100%", "100%", 0);
tvHistory.height = document.getElementById("hiddenTreeHeight").value;
tvHistory.setImagePath("Images/");
var clientID = document.getElementById("hiddenClientID").value;
var historyTree_xmlFile = "xmlFiles/" + clientID + "_historytree.xml";
tvHistory.loadXML(historyTree_xmlFile);
tvHistory.attachEvent("onClick", GetLocationFromTree);

This function is called once the xmlfile is available.

My problem is the "onClick" event, this fires for each line in the xmlfile, while the file is being rendered. If I change the event to "onDblClick" the event then fires as expected, on the doubloe click.

I would not expect the "onClick" to fire when the grid is being populated. Can you advise what is wrong.

Many Thanks
Answer posted by Support on Dec 09, 2008 01:42
Which attributes you are using for items in XML?
If items in XML has "call" attribute - it will generate "onClick" event during loading. ( you need not such attribute to just allow normal onClick event )
Answer posted by Rory Gilleran on Dec 09, 2008 01:50

Great, perfect answer, problem now resolved.

Many Thanks