日期:2014-05-16  浏览次数:20719 次

Extjs textfield 只读的情况
在填写表单的时候 可以输入
在表单修改的时候 ID项不能修改 设置为只读
在网上搜到三三种解决方案都不可行

NewShipForm.getForm().findField('ID').getEl().dom.readOnly = true;
结果:失败
ReadOnly:true;
结果:失败
Ext.getCmp('sorgcode').getEl().dom.readOnly = true;

都失败了

// 初始化表单
    function initUpdateForm(form) {
        form.getForm().load({
            url: FORM_INIT_URL,
            method: 'GET',
            success: function (form, action) {
                setFormFieldValue(updateForm, 'action', 'add');
                // updateForm.setTitle("新增机构信息");
            },
            failure: function (form, action) {
                Ext.Msg.alert('提示', action.errors);
            }
        });

    }




 // 构造表单
    var updateFormTitle = "新增机构信息";
    var updateForm = Ext.create('Ext.form.Panel', {
        buttonAlign: 'center',
        id: 'form_update',
        margin: '0 0 10px 0',
        layout: "form",
        bodyStyle: {
            padding: '10px',
            borderWidth: '1px 0 0 0'
        },

        frame: false,
        border: 0,
        bodyPadding: '10 10 0',
        defaults: {
            allowBlank: false,
            msgTarget: 'side',