簡體   English   中英

JQGRID-關於“編輯對話框(彈出)”上的復選框狀態,禁用/啟用文本框的只讀屬性

[英]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.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM