简体   繁体   English

JQGRID-关于“编辑对话框(弹出)”上的复选框状态,禁用/启用文本框的只读属性

[英]JQGRID - disable/enable textbox's readonly property with respect to checkbox status on “edit dialog box(popup)”

JQGRID - On load of edit popup, a Textbox should be made readonly if the checkbox is unchecked . JQGRID-在加载编辑弹出窗口时,如果未选中复选框,则文本框应设为只读。 The textbox should be editable if checkbox is checked. 如果选中复选框,则文本框应可编辑。

Try to use dataEvents in colModel. 尝试在colModel中使用dataEvents

try to implement your checkboxfield like this ... 尝试像这样实现您的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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM