JQGRID - 加载编辑弹出窗口时,如果取消选中该复选框,则应该只读取文本框。如果选中复选框,则文本框应该是可编辑的。
答案 0 :(得分:1)
尝试在colModel中使用dataEvents
。
尝试像这样实现你的复选框......
colModel: [
{name: 'checkboxfield', sortable: true, sortorder: "ASC", sorttype: "string", editable: true,editoptions: {
value: "Active:Inactive", defaultValue: "Active",
dataEvents: [{
type: "change",
fn: function (e) {
var $this = $(e.target), columnName = "textboxfield",cellId;
if ($this.hasClass("FormElement")) {
cellId = columnName;
}
if ($this.is(":checked")) {
$("#" + $.jgrid.jqID(cellId)).prop("readonly", false);
}
else {
$("#" + $.jgrid.jqID(cellId)).prop("readonly", true);
}
}
}]
}, edittype: "checkbox",
},
{name: 'textboxfield', sortable: true, sortorder: "ASC", sorttype: "string", editable: true, edittype: 'text'},
]