var combo_st_id;
// util_devComboS 是定义好的一函数
var devComboStore = util_devComboStore(combo_st_id);
combo_st_id=12;
devComboStore.load(); //这事什么意思
[b]问题补充:[/b]
//定义了一个function
function util_devComboStore(st_id) {
//定义一个数据存储器Ext.data.Store,必须由两部分组成:数据源(DataProxy),数据解析器(DataReader)
//才能工作。
var store = new Ext.data.Store({
proxy : new Ext.data.HttpProxy({
url : url + '?m=' + constinfo.module.BASEDATA
+ '&a='
+ constinfo.basedataAction.GET_DEV_JSON
+ '&v=' + st_id
}),
reader : new Ext.data.JsonReader({
root : 'root'
}, [{
name : 'dev_id'
}, {
name : 'dev_name'
}])
});
return store;
}
//
//然后在下拉列表的select事件中如下声明,意在点击下拉列表时另一个下拉框
//能对应显示
var form = new Ext.form.FormPanel({
id : 'copyPage',
frame : true,
loadMask : true,
waitMsgTarget : true,
monitorValid : true,
autoHeight : true,
closeAction : 'close',
// bodyStyle : "padding:5px 5px 0",
items : [{
xtype : "fieldset",
defaultType : 'textfield',
autoHeight : true,
title : '请选择要复制的设备',
items : [{
id : 'st_combo',
fieldLabel : "变电站",
xtype : 'combo',
selectOnFocus : true,
editable : false,
readOnly : true,
triggerAction : 'all',
store : stComboStore, //指定store
allowBlank : false,
blankText : "必须选择一项",//如果allowBlank验证失败,显示的错误信息
valueField : 'st_id',
hiddenName : 'st_id',
displayField : 'st_name',
anchor : "90%",
listeners : { //选择变电站时,自动填充变压器列表
"select" : function(combo) {
combo_st_id = combo.value;
// alert("combo_st_id is"+combo_st_id);
//devComboStore = util_devComboStore(combo_st_id);
//if(devComboStore==null)alert("devComboStore is null" );
//The DataProxy object which provides access to a data object
/* devComboStore.proxy表示:指定devComboStore的数据源
* devComboStore.proxy = new Ext.data.HttpProxy({//重新指定数据源。可以达到效果,可是方法中已经指定数据源了啊
url : url
+ '?m='
+ constinfo.module.BASEDATA
+ '&a='
+ constinfo.basedataAction.GET_DEV_JSON
+ '&v=' + combo_st_id
});
devComboStore.load(); //加载数据记录到缓存中*/
// devComboStore.load();
//if(devComboStore!=null)alert("devComboStore is not null");
}
}
}, {
id : 'dev_combo',
fieldLabel : "设备",
xtype : 'combo',
selectOnFocus : true,
editable : false,
readOnly : true,
triggerAction : 'all',
// store : devComboStore,
store:util_devComboStore(combo_st_id), //[b][/b][color=red][/color]没有达到效果啊!!
allowBlank : false,
blankText : "必须选择一项",
valueField : 'dev_id',
hiddenName : 'dev_id',
displayField : 'dev_name',
listeners : {
"select" : function(combo) {
combo_dev_id = combo.value;
}
}
}]
}],