【发布时间】:2011-08-30 18:27:55
【问题描述】:
我的数据库中有真/假值。我想用 jqgrid 中的复选框更新它们。 一旦该值设置为 true,它将保持为 true 并且不应更改。请看一下我的专栏模型:
{
name : 'available',
width : 12,
resizable: true,
editable: true,
align: 'center',
edittype:'checkbox',
formatter: "checkbox", formatoptions: {disabled : false},
classes:'check',
editrules:{required:false}, editoptions:{size:39,value:"True:False"}
}
我正在尝试在选中复选框时捕获事件,目前它们都未选中,到目前为止我已经尝试过:
jq(".check input").each(function(){
jq(this).click(function(){
aler("works");
});
});
jq("input[type='checkbox']").change(function(){
alert("works");
});
jq(":checkbox").parent().click(function(evt) {
if (evt.target.type !== 'checkbox') {
var $checkbox = jq(":checkbox", this);
$checkbox.attr('checked', !$checkbox.attr('checked'));
$checkbox.change();
alert("");
}
});
这些都不起作用,我被卡住了,不知道还能尝试什么。
当使用 firebug 检查复选框代码时,它看起来像这样:
<input type="checkbox" offval="no" value="false">
【问题讨论】:
标签: javascript jquery jqgrid