防止jqGrid中的行上的click事件 [英] Prevent click event on row in jqGrid

查看:469
本文介绍了防止jqGrid中的行上的click事件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在jqgrid网格中,我有一个复选框作为第一列和其他一些列。当我点击行(无处不在)时,复选框切换为选中或取消选中。

In a jqgrid grid, I have a checkbox as first column and some other columns. When I click on the row (everywhere) the checkbox switch to checked or to unchecked.

您能告诉我所有行上的点击事件吗?我想在网格生成后执行此操作,因为网格是由框架创建的。

Could you tell me how "click" event on all row ? I'd like to do this after the grid generation because the grid is created by a framework.

谢谢,

推荐答案

您可以使用 setGridParam 方法注册 beforeSelectRow 事件处理程序在现有网格上。该处理程序应返回 false 以取消选择操作。

You can use the setGridParam method to register a beforeSelectRow event handler on an existing grid. That handler should return false to cancel the selection operation.

在您的情况下,您可以使用是()方法事件的/rel =nofollow>目标属性,以确定是否在复选框上启动了点击。最终结果如下:

In your case, you can use the the is() method on the target property of the event in order to determine if the click was initiated on the check box. The end result would be something like:

$("#yourGrid").jqGrid("setGridParam", {
    beforeSelectRow: function(rowId, e) {
        return $(e.target).is("input:checkbox");
    }
});

这篇关于防止jqGrid中的行上的click事件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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