ExtJs 动态修改组件的属性值,并重新渲染组件

//定义一个组件添加到formPanel中
var dqszj = {
					fieldLabel:'当前所在级',									
					xtype:'combo',
					hiddenName:'dqszj',
					readOnly:true,
					triggerAction:'all',
					displayField:"dmmc",
					emptyText:'必填',
					allowBlank:false,
					valueField:'dmjc',
					store:new Ext.data.JsonStore({
						url:contextPath+'/system/jcsdAction.do?method=getQtdm&dmlb=nj',
						autoLoad:true,
						fields:["dmjc","dmmc"]
					})
			};
			
			var form = new Ext.FormPanel({
				id:'addForm',
				layout:'form',
				titile:'form',
				border:false,
				bodyStyle:'padding:5px',
				defaults:{
					xtype:'fieldset',
					margins:'4 4 4 4',
					labelWidth:90,
					collapsible:true
				}
//在此修改属性
if(formData.sfbt == "true"){
           textfield.allowBlank = true;
           
	textfield.emptyText = '';   
        textfield.reset(); 
        textfield.hide();
        textfield.show();
效果如下:


//最开始尝试了很多方法,均达不到效果。

//textfield.clearInvalid();
           //textfield.setEmptyText("");
           //textfield.render();
           //Ext.getCmp('addForm').render();
           
           
           //Ext.getCmp('addForm').remove(dqszj);
           //Ext.getCmp('addForm').add(dqszj);
           //Ext.getCmp('addForm').doLayout();

           //form.getForm().findField(xm).getEl().dom.readOnly = true;

你可能感兴趣的:(layout,url,ExtJs,border,autoload)