| Page 1 of 1 | [ 5 posts ] |
|
Hi,
I am usning treeview and try to stop collapsing feature on click event.I want to implement the collapse or expand for double click and not for single click. My code is prety much like http://developer.yahoo.com/yui/examples ... _tree.html I appriciate your help. Thanks, rmj. |
|
Plain click is hardwired to toggling when done on the plus/minus sign. That you cannot change.
However, you can listen to click event, do whatever you want in response to it and return false (just as with regular DOM events) to prevent toggling. Then you can set up an event listener for double click and call node.toggle yourself. This would be weird: simple clicking on the toggle icon but double clicking on the label. Using double click might not be a good idea for another reason: it will slow down every click listener. When there is a double click, browsers will emit two click events first. TreeView solves it by checking if anyone has subscribed to double-click. If no one has, then every click is passed through. If someone is listening to double click, on the first click it will keep quiet about it and launch a timer. If no click happens before a timeout, it assumes it wasn't a double click and responds to that first click. If a second click happens, then it fires the double click event. However, for any regular click, it will delay until it is sure it is not double. So, if you can avoid it, don't use double click. |
|
Thank you very much for quick reply.
I tried following code and it's not working tree.subscribe("clickEvent", function(node) { return; }); am doing something wrong here? Thanks, Murali. |
|
How about "return false" as I said? Returning undefined is not the same as returning false.
|
|
Thank you very much.
"return false" is working. Thanks, rmjrao. |
| Page 1 of 1 | [ 5 posts ] |
| You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum |
© 2006-2013 Yahoo! Inc. All rights reserved.
All code on this site is licensed under the BSD License unless stated otherwise.
About This Site · Security Contact Info
Powered by phpBB® Forum Software © phpBB Group