Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/extjs/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
制作';文本字段';使用ExtJS3.3实现只读条件_Extjs_Extjs3 - Fatal编程技术网

制作';文本字段';使用ExtJS3.3实现只读条件

制作';文本字段';使用ExtJS3.3实现只读条件,extjs,extjs3,Extjs,Extjs3,我正在使用extjs3.3,我的formpanel有以下代码: Ext.apply(this, { items: [{ xtype: 'textfield', fieldLabel: 'ApplicationGUID', labelAlign: 'right', name: 'Application_GUID', value: 0, readOn

我正在使用extjs3.3,我的
formpanel
有以下代码:

Ext.apply(this, {
    items: [{
            xtype: 'textfield',
            fieldLabel: 'ApplicationGUID',
            labelAlign: 'right',
            name: 'Application_GUID',
            value: 0,
            readOnly: false,
            width: 300
        },
        {
            xtype: 'textfield',
            fieldLabel: 'ApplicationName',
            labelAlign: 'right',
            name: 'Application_Name',
            anchor: '-20',
            msgTarget: 'side'
        }

    ], //eof items
    tbar: [{
        xtype: 'mydeletebutton',
        scope: this,
        ownerCt: this,
        handler: this.deleteHandler,
        myAuth: {
            compBaseRights: {
                Delete: {
                    failProperty: {
                        disabled: false
                    }
                } /*eof Delete*/
            } /*eof compBaseRights*/
        } /*eof sgAuth*/
    }, {
        xtype: 'tbseparator'
    }, {
        xtype: 'trashcanbutton',
        scope: this,
        ownerCt: this,
        handler: this.setIsDeletedHandler,
        myAuth: {
            compBaseRights: {
                Insert: {
                    failProperty: {
                        disabled: false
                    }
                } /*eof Delete*/
            } /*eof compBaseRights*/
        }
    }, {
        xtype: 'mytrashcanrestorebutton',
        scope: this,
        ownerCt: this,
        handler: this.unsetIsDeletedHandler,
        myAuth: {
            compBaseRights: {
                Insert: {
                    failProperty: {
                        disabled: false
                    }
                } /*eof Delete*/
            } /*eof compBaseRights*/
        }
    }, {
        xtype: 'tbseparator'
    }, {
        xtype: 'mysavebutton',
        scope: this,
        handler: this.saveHandler,
        myAuth: {
            compBaseRights: {
                Write: {
                    failProperty: {
                        disabled: false
                    }
                } /*eof Delete*/
            } /*eof compBaseRights*/
        }
    }],
    bbar: {
        xtype: 'mystatusbar'
    }
});
我要寻找的是,对于
textfield
Application\u GUID,如果一个值已经存在(比如双击网格中的一个现有值以进行编辑),并且如果我从
网格中按下new按钮,我需要是
readOnly:true
,我需要将
readonly
语句设置为
false


如果有人能帮我,那就太麻烦了。谢谢。

一种很好的方法是将布尔变量初始化为false。然后根据您的需要将其设置为true

然后添加所需的侦听器,如以下示例代码中所示,例如在change listener上:

listeners: {
    yourlistener: function(e) { //yourlistener can be change, select, etc...
        if (booleanVariable === true) Ext.getCmp('your-textbox-id').setReadOnly(true);
        else Ext.getCmp('your-textbox-id').setReadOnly(false);
    }
 }