Hi!
I want to add a double click behavior for the tree. Since there is no such event, i was hoping to use the node edit functionality. Is there somway to stop the edit box from appearing by handling the before begin update event of the the tree.
Or if someone has a better idea please let me know.
Ahmad
I also tried to figure out a way to cancel the event, unfortunately without success - it seems that NodeEdit cannot be cancelled. I found a way to deal with this problem though - hopefully it will work fine for you. The idea is to override the igtree_beginedit javascript method UltraWebTree is using for its editing logic - since you are not going to need it anyway - just place your javascript code there. It will act sort of an double click event handler. (just make sure you have placed the definition after your UltraWebTree declaration).
Example:
<ignav:UltraWebTree ID="UltraWebTree1" runat="server" Editable="true"> <Nodes> ... </Nodes> </ignav:UltraWebTree> <script language="javascript"> function igtree_beginedit(tn,nodeId) { var node = igtree_getNodeById(nodeId); //custom logic here } </script>
Thanks,
This works fine. One question though. Is there any way to keep the node edit funcitonality as well.
I was going through the js file and found another function
function igtree_dblclick(evnt,tn)
This way edit and dblclick can work along side. But now i have another problem. On double click the selected node property of the tree doesnot change. As a result when i post back to the server i get the previously selected node. Looking through the code to set this straight. Any ideas?
Maybe calling explicitly the client-side (CSOM)
method to explicitly select the node needed will do the trick?
I tried using calling setSelectedNode, but the serverside SelectedNode property of the tree doesnot change.
That's unfortunate, but could be expected since we are over-riding a lot of the internal functions of UltraWebTree (javascript is a wonderful language, you can do anything with it).
So, I guess, one possible solution is to use a hidden-field on the page, e.g.
<asp:HiddenField runat="server" ID="HiddenField1" />
and then set the value of the hidden to the, say, index or id or text or something unique that describes the node to be selected, e.g.
var hiddenField = document.getElementById("<%= HiddenField1.ClientID %>");
hiddenField.value = myNodeIntance.getText();
and then, back in the server-side, use the value in HiddenField instead of SelectedNode for the tree.
Yes, I am currently esclating this feature request to PM and chances are we will have this in next release (depending on work-load / priorities).
I have suggested implementing a server-side NodeDoubleClick event + a couple of before / after client-side CSOM events for that + the functionality that the before event should ba cancellable.
If you have some suggestions/ideas on API / Implementation, please let me know. I will pass anything you suggest to PM as well.
Thanks a lot.
Yeah, i ended up doing this. :)
Cant infragisitcs provide a publically exposed event for double click in the future.