Does anyone know how to manually trigger item click event of Dojo tree? I have a create new node button and whenever a new node is created, I would like to move focus to the new node. I have setup the click event and it would be great if I can manually trigger click event with the param is the new node.
A:
Do you need to send the click event or just set focus?
To set focus you could do:
dojo.byId("myNewNode").focus();
mopoke
2010-01-04 04:00:35
Thanks mopoke for fast reply. Actually, I need to set focus to the new node and fire the click event also since I have setup some code in the item click event. The GUI should display the new node as selected.Thanks!
hoangnghiem1711
2010-01-04 04:04:30
Ah, OK. You might be able to use document.createEvent but that doesn't work in IE. IE allows you to use a fireEvent method.
mopoke
2010-01-04 04:13:01
Yes, I'll give it a try. Thanks!!!
hoangnghiem1711
2010-01-04 04:24:04
A:
var yourtree = dijit.byId("<treeid>");
use dojo.connect(yourtree, "onClick", function(item){
<write custom logic here>
});
Rajat
2010-01-04 21:43:48