您的位置:首页 > Web前端 > JavaScript

Extjs二级联动

2016-02-17 10:30 363 查看
var liveweatherNameData = null;
DWREngine.setAsync(false); 
sfileMgrService.findLiveWeatherNameDate(function(data){
liveweatherNameData =  data;
});
DWREngine.setAsync(true);
var liveweatherNameStore = new Ext.data.SimpleStore({
fields:['value','text'],
data:liveweatherNameData
});

var fileNameData = null;
DWREngine.setAsync(false); 
sfileMgrService.findFileNameData(10000,function(data){
fileNameData =  data;
});
DWREngine.setAsync(true);
var fileNameStore = new Ext.data.SimpleStore({
fields:['value','text'],
data:fileNameData
});

    liveweatherName = new Ext.form.ComboBox({
store:liveweatherNameStore,
fieldLabel:'天气实况',
width:150,
emptyText:'请选择天气实况',
id:'liveweatherName',
mode:'local',
triggerAction:'all',
valueField:'value',
displayField:'text',
Dropdownstyle:'Dropdownlist',
allowBlank:false,
listeners: {// select监听函数  

             select : function(combo, record, index){  

                 fileName.reset();

                 fileName.store.removeAll();

              DWREngine.setAsync(false); 

              var typeId = combo.value;

              sfileMgrService.findFileNameData(typeId,function(data){

              fileNameData =  data;

              });

              console.info(fileNameData);

             

              DWREngine.setAsync(true);

              fileNameStore.loadData(fileNameData); 

 
}    

}  
});

 

/*  fileName = new Ext.form.TextField({
fieldLabel:'文件类型2',
allowBlank:false,
name:'filename',
maxLength:50,
width:150
}); */ 

fileName = new Ext.form.ComboBox({
store:fileNameStore,
fieldLabel:'文件类型2',
width:150,
emptyText:'请选择文件类型1',
id:'fileName',
mode:'local',
triggerAction:'all',
valueField:'value',
displayField:'text',
Dropdownstyle:'Dropdownlist',
allowBlank:false
}); 
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: