JQGRID - 在加载编辑弹出窗口时,如果未选中该复选框,则应将文本框设置为只读。如果选中复选框,则文本框应该是可编辑的。
最佳答案
尝试在 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'},
]
关于javascript - JQGRID - 禁用/启用文本框相对于 "edit dialog box(popup)"上的复选框状态的只读属性,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34605199/