第1个回答 推荐于2016-02-23
代码如下:
varprovinceStore=newExt.data.Store({
proxy:newExt.data.HttpProxy({url:basePath+"/stationManage/station_getProvinceJSON.action"}),
reader:newExt.data.JsonReader(
{root:""},
["PROVINCEID","PROVINCENAME"]
)
});
//选择省市
varprovinceIDadd=newExt.form.ComboBox({
anchor:'98%',
id:'provinceIDadd',
name:"provinceIDAdd1",
hiddenName:"provinceID",
displayField:"PROVINCENAME",
valueField:"PROVINCEID",
blankText:'请选择站点所属省份',
emptyText:'请选择站点所属省份',
fieldLabel:'站点所属省份',
allowBlank:false,
editable:false,
triggerAction:'all',
store:provinceStore,
forceSelection:true,
mode:'local',
selectOnFocus:true
})
provinceStore.load();
后台action代码
代码如下:
publicclassStationActionextendsBaseAction{
privateList<Map<String,Object>>provinceList;
publicvoidsetProvinceList(List<Map<String,Object>>provinceList){
this.provinceList=provinceList;
}
publicList<Map<String,Object>>getProvinceList(){
returnprovinceList;
}
publicStringgetProvinceJSON(){
Stringsql="SELECTPK_IDPROVINCEID,NAMEPROVINCENAMEFROMT_DICT_DISTRICTAWHEREA.DISTRICT_LEVEL=20";
provinceList=stationService.findBySQL(sql);
return"json_getProvinceList";
}
}
strtusxml配置
代码如下:
<resultname="json_getProvinceList"type="json">
<paramname="root">provinceList</param>
</result>
加载静态数据的下拉选择框
代码如下:
vardataType=[['0','8列'],['1','38列'],['2','21列']];
vardataTypeStore=newExt.data.SimpleStore({
fields:['dataTypeID','dataTypeName'],
data:data
});
vardataTypedd=newExt.form.ComboBox({
anchor:'98%',
id:'dataTypeadd',
name:"dataTypeAdd1",
hiddenName:"dataType",
displayField:"dataTypeName",
valueField:"dataTypeID",
blankText:'请选择数据格式',
emptyText:'请选择数据格式',
fieldLabel:'数据格式',
allowBlank:false,
editable:false,
triggerAction:'all',
store:unitStore,
forceSelection:true,
mode:'local',
selectOnFocus:true
})本回答被提问者和网友采纳