tree click and dblclick both raised - Ext JS

本文讨论了在用户界面中实现点击与双击事件时遇到的问题,特别是在YUI Ext框架下,如何避免双击触发两次点击事件。提出了通过检查预加载状态来区分点击与双击的方法,并探讨了修改延迟时间及使用辅助键来区分两种事件的技术方案。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

In my tree setup i'm catching the node click and dblclick, but for a doudble click the single click event is also raised..

In this post the problem is also mentioned.. Anyone added this code to the tree?

http://www.yui-ext.com/forum/viewtop...e9f3899c53fed6

Thanks

Marco
Reply With Quote
  #2  
Old 03-15-2007, 10:37 AM
Default

Qouted from quirksmoede:

"The dblclick event fires after the user has clicked twice in rapid succesion on the same element. All browsers support it.
The incompatibilities are in the succession of events leading up to the dblclick. Every browser uses a different event order.

In practice it is not possible to use both the click and dblclick events on the same element. The browsers aren't sufficiently able to distinguish between them"

That said it depends on what you want to do when the click and dbl click happens.
For example, I have had an outlook like list that onclick loads the preview and ondblclick opens an edit window. To avoid double loading the click just checks to see if the preview already contains the right information. So you can make your click handler look for evidence of a dblclick, bt the fact that it has been called twice. If you absolutely need to prevent the click handler from firing, you will need to delay the execution long enough to allow the dblclick to fire first and it will need to cancel the clickTimeout.
Reply With Quote
  #3  
Old 03-15-2007, 11:04 AM
Default

Thanks.. i've got a similar situation (on two places)..
- tree
. click = change activepanel in center with a new page
. dblclick = add new panel in center with a new page

- grid
. click = load preview
. dblclclick = show edit dialog

The default doubleclick delay in windows is set to 500ms.. That means that a click event should only be raised if not within 500ms a new click has been catched.. That's a long delay before something is happening after a single click..

I think i change the code to look for a shift / control key and single click.. Other ideas are welcome!!

Thanks

Marco
Reply With Quote
  #4  
Old 03-15-2007, 11:21 AM
Default

Quote:
- tree
. click = change activepanel in center with a new page
. dblclick = add new panel in center with a new page
Out of curiosity, are you saying that double-clicking an existing node in the tree creates a newly added node/panel? That seems like a strange interaction to me. I would think you'd have a special "Add" node or a separate button outside the tree.

Quote:
- grid
. click = load preview
. dblclclick = show edit dialog
Seems like you'd want both to happen regardless, right? If you have an active preview loaded and you immediately double-click on a different row, you would want to refresh the preview AND show the edit for the previewed item right?
__________________
Brian Moeskau
FAQ / Tutorials / User Extensions / Enhanced Forum Search
Reply With Quote
  #5  
Old 03-15-2007, 12:30 PM
Default

Quote:
Originally Posted by bmoeskau
Out of curiosity, are you saying that double-clicking an existing node in the tree creates a newly added node/panel? That seems like a strange interaction to me. I would think you'd have a special "Add" node or a separate button outside the tree.
My tree contains only folders.. Each folder contains objects that are shown in a (paging) grid in the center panel.. I want to have multiple tabs in the centerpanel, each tab contains the objects from a folder.. Users can decide if they want to view the contents in a separate tab (or load the contents in the active tab) by dblclicking (at least that was my idea)

Thanks
Marco
Reply With Quote
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值