![](/img/trans.png)
[英]Disable select box and enable textbox using one checkbox with JavaScript
[英]JQGRID - disable/enable textbox's readonly property with respect to checkbox status on “edit dialog box(popup)”
JQGRID-在加载编辑弹出窗口时,如果未选中复选框,则文本框应设为只读。 如果选中复选框,则文本框应可编辑。
尝试在colModel中使用dataEvents
。
尝试像这样实现您的checkboxfield ...
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'},
]
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.