防止beforeSelectRow事件,当用户双击jqgrid中的任何行 [英] prevent beforeSelectRow event, when a user doubleClick any Row in jqgrid

查看:3780
本文介绍了防止beforeSelectRow事件,当用户双击jqgrid中的任何行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用jqgrid中的单元格编辑,因此我正在使用许多不同的jqgrid事件,如下所述...
1)beforeSelectRow,2)beforeEditCell,3)afterEditCell,4)onCellSelect,5) ondblClickRow等...



现在,当我双击任何行时,beforeselectRow代码首先执行..我想要防止...但是如何这样做?



一些示例代码如下: -

  ondblClickRow:function(id,irow,icol,e)
{
........
},
beforeSelectRow:function(rowid,e)
{

if(rowid == lastSelected)
{
$ sampleDialog.dialog('open');
}
}


解决方案

Web浏览器以一些不同的方式处理双击事件。因此,一般来说,您不能在dblclick之前阻止点击事件。回调 beforeSelectRow 将被调用在中,位于jqGrid代码内部定义的 enevt处理程序。在 dblclick 事件处理程序的jQuery文档中,您可以阅读以下内容(请参阅这里):


将处理程序绑定到点击 dblclick
同一元素的事件。触发的事件顺序从浏览器到浏览器的
变化,一些在
之前收到两个事件事件 dblclick 等只有一个。双击灵敏度(最大
双击时检测到的点击之间的时间)可以由
操作系统和浏览器变化,并且通常是用户可配置的。


您目前所做的只是不推荐的方式来绑定 'click'和'dblclick'句柄。



你没有描述你原来的问题,它可能在 ondblClickRow 回调实现之内。唯一的解决方案是检查程序的重组,以便在 beforeSelectRow ondblClickRow 回调之间的操作之间没有冲突。


I am using cell editing in jqgrid and for that, i am using many different jqgrid events, as mentioned below ... 1) beforeSelectRow, 2)beforeEditCell, 3)afterEditCell, 4)onCellSelect, 5)ondblClickRow, etc...

Now, when i doubleClick on any of the row, the beforeselectRow code gets executed first.. which i want to prevent... but how to do that ??

Some example code is as below :-

ondblClickRow: function(id,irow,icol,e)
{
  ........
},
beforeSelectRow : function(rowid, e) 
{   

    if(rowid==lastSelected)
    {
        $sampleDialog.dialog('open');
    }
}

解决方案

Different web browsers process the double-click event in a little different ways. So in general you can't prevent 'click' event before 'dblclick'. The callback beforeSelectRow will be called inside of click enevt handler defined inside of jqGrid code. In jQuery documentation of dblclick event handler you can read the following (see here):

It is inadvisable to bind handlers to both the click and dblclick events for the same element. The sequence of events triggered varies from browser to browser, with some receiving two click events before the dblclick and others only one. Double-click sensitivity (maximum time between clicks that is detected as a double click) can vary by operating system and browser, and is often user-configurable.

What you currently do is just not recommended way to binding both 'click' and 'dblclick' handles.

You don't describe the original problem which you has which is probably somewhere inside of ondblClickRow callback implementation. The only solution will be to examine reorganization of the program to have no collisions between the actions inside of beforeSelectRow and ondblClickRow callbacks.

这篇关于防止beforeSelectRow事件,当用户双击jqgrid中的任何行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆