Extjs 两个JsonStore 使用同一个url(action)时问题

困扰了我很久的问题,在网上找找,也没找解决办法。

问题是,我在一个页面上有两个ComboBox,数据来源是同一个action(我使用的struts2)
还是看看代码吧
var store_comBox_volt = new Ext.data.JsonStore({
         url : "dropAction!getVoltDrop.action",
	root : 'volt',
	fields : ['id', 'name']
	});
store_comBox_volt.load()
var comBox_volt = new Ext.form.ComboBox({ // combobox
	fieldLabel : '电压等级',
	displayField : 'key',
	width:'50',
	mode : 'local',
	store : store_comBox_volt,
	displayField : 'name',
	valueField : 'id',
	forceSelection : true,
	triggerAction : 'all',
	selectOnFocus : true,
	typeAhead : true
	});


 var store_comBox_org = new Ext.data.JsonStore({
						url : "dropAction!getOrgsDrop.action",
	root : 'orgs',
	fields : ['id', 'name']
	});	
store_comBox_org.load();
var comBox_org = new Ext.form.ComboBox({ // combobox
	fieldLabel : '管理单位',
	displayField : 'key',
	mode : 'local',
	store : store_comBox_org,
	displayField : 'name',
	forceSelection : true,
	triggerAction : 'all',
	selectOnFocus : true,
	typeAhead : true
	 });

后台处理正常,但在页面上不显示。不知道什么原因。后来,在网上看到:EXT用定时检查的方法处理连接是否正常结束的问题,每50毫秒一次。
我就在store_comBox_org上加一个定时器。
setTimeout(function(){store_comBox_volt.load()},100);
这样就正常了。

你可能感兴趣的:(spring,Hibernate,Ajax,配置管理,ext)