如何在jQgrid标头中添加复选框 [英] How can I add a checkbox into a jQgrid header

查看:222
本文介绍了如何在jQgrid标头中添加复选框的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

每个jQgrid行都有多个复选框,因此我不能使用(仅)多重选择.

Each jQgrid row has multiple checkboxes, so I cannot use (just) the multiselect.

这是设置列的方式...

This is how the column is setup...

{名称:"ColName",标签:",宽度:50, 可true,可排序:false,可编辑类型:复选框",格式设置: 'checkbox',格式选项:{Disabled:false},索引:"my_checkbox", editoptions:{值:是":否"}}

{ name: 'ColName', label: '', width: 50, editable: true, sortable: false, edittype: "checkbox", formatter: 'checkbox', formatoptions: { disabled:false}, index:"my_checkbox", editoptions: {value:"Yes":"No"} }

当我单击标题中的复选框时,将重新绘制标题,而不会选中该复选框.我可以捕获事件,但是无法向用户显示支票.

When I click the checkbox in the header, the header is redrawn without the check. I can capture the event, but cannot display the check to the user.

所以我的问题是,如何获得一个在标题标签中正常运行的复选框,或者如何实现多个多重选择.

So my question would be, how can I get a checkbox to operate normally inside a header label OR how can I implement multiple multiselects.

推荐答案

我能够通过防止在复选框事件之后触发jQgrid事件来解决问题.

I was able to fix my problem by preventing the jQgrid events from firing after the checkbox event.

我将复选框更改为...

I changed my checkbox to...

<input type="checkbox" onclick="checkBox(event)" />

并添加了以下方法...

and added the following method...

function checkBox(e) {
  e = e||event;/* get IE event ( not passed ) */
  e.stopPropagation? e.stopPropagation() : e.cancelBubble = true;
}

这篇关于如何在jQgrid标头中添加复选框的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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