Tree OnSelect Event

Hi,
Currently I’m working on dhtmlxTree object. I’ve attached onSelect event using attachEvent() api. I’m using XML to load tree data. I’ve sent one node as select = “1” but the onSelect event is not getting fired. It is not fired even in case of selectItem() api. Please help me with the same.

Thanks.

Hello,

to call onSelect event handler you may use “call” attribute - it selects item and call event for it (“select” attributes just highlights an item):

<item call=“1” …>

Moreover you can call onSelect event using selectItem method too - teh second parameter should be true:

tree.selectItem(itemId,true);

Hi,
In my application i’m sending tree xml from server using loadxml api. I’ve attached “onOpenStart” with the tree object. This event is getting fired even if the tree node is already expanded. That is I’m already sending expanded tree node from server. Is there any way to avoid this extra call as the tree node is already expanded there is no need to fire the event again. Waiting for your reply.

Thanks,
Yogesh

Hello,

you may set onOpenStart event handler after xml loading:

tree.loadXML(url,doAfterLoading)

function doAfterLoading(){
tree.attachEvent(“onOpenStart”,handler)
}