Extjs form中动态显示图片

    技术2026-10-02  4

     

    items: [{ columnWidth: .5, layout: 'form', defaultType: 'textfield', defaults: { width: 200 }, items: [{ xtype: 'textfield', fieldLabel: '姓名', readOnly:true, name: 'staff.staffName', id:'STAFF_NAME', allowBlank: false },{ xtype: 'textfield', fieldLabel: '账号', readOnly:true, id:'STAFF_ACCOUNT', name: 'staff.staffAccount', allowBlank: false }, { xtype: 'textfield', fieldLabel: '密码', id:'STAFF_PASSWD', readOnly:true, name: 'staff.staffPasswd', inputType: 'password', allowBlank: false }, { xtype: 'textfield', fieldLabel: '邮箱', id:'STAFF_EMAIL', name: 'staff.staffEmail', vtype: 'email' },{ xtype: 'textfield', fieldLabel: '通信地址', id:'ADDRESS', name: 'staff.address' }, { xtype: 'textfield', fieldLabel: '移动电话', id:'STAFF_MOBILE', name: 'staff.staffMobile' }, { xtype: 'textfield', fieldLabel: '备注', id:'STAFF_MEMO', name: 'staff.memo' }, { xtype: 'textfield', fieldLabel: '员工编号', readOnly:true, id:'STAFF_CODE', name: 'staff.staffCode' }, { xtype: 'textfield', fieldLabel: '员工职务', id:'STAFF_JOB', name: 'staff.staffJob' }, { xtype: 'textfield', fieldLabel: '借调开始', id:'BORROW_START_TIME', name: 'staff.borrowStartTime' }, { xtype: 'hidden', id:'PICTURE_URL', name: 'staff.pictureUrl' },{ xtype: 'textarea', fieldLabel: '借调备注1', id:'BORROW_MEMO1', name: 'staff.borrowMemo1' }] }, { columnWidth: .5, layout: 'form', defaults: { width: 200 }, items: [{ id: 'IDSBPictures', name: 'nameSBPictures', fieldLabel: '个人照片', xtype: 'box', //或者xtype: 'component', width: 110, //图片宽度 height: 150, //图片高度 autoEl: { tag: 'img' //指定为img标签 } },  动态改变IDSBPictures的src值

     

     var _PICTURE_URL = Ext.getCmp("PICTURE_URL").getValue();

     Ext.getCmp("IDSBPictures").getEl().dom.src = _PICTURE_URL;

     

     


     

     

    取textfield的值可以用Ext.getCmp(id).getValue();

     


     

     

     

    var value="**";

    (1) fs.form.findField(id/name).setValue(value);

    (2) Ext.get(id/name).setValue(value);

    (3) Ext.getCmp(id).setValue(value);

     

    获取form里面的field的三种方法

    1)Ext.getCmp('id');

    2)FormPanel.getForm().findField('id/name');

    3)Ext.get('id/name');//前提是FormPanel在界面上显示出 来了

     

     


    隐藏

    hidden: true, hideLabel:true 

     

     

     

     

    最新回复(0)