网站首页  汉语字词  英语词汇  考试资料  写作素材  旧版资料

请输入您要查询的考试资料:

 

标题 ext combobox动态加载数据库数据(附前后台)
内容
    这篇文章主要介绍了extcombobox动态加载数据库数据并附前后台实现,需要的朋友可以参考下。
    前台:
    代码如下:
    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
    })
随便看

 

在线学习网考试资料包含高考、自考、专升本考试、人事考试、公务员考试、大学生村官考试、特岗教师招聘考试、事业单位招聘考试、企业人才招聘、银行招聘、教师招聘、农村信用社招聘、各类资格证书考试等各类考试资料。

 

Copyright © 2002-2024 cuapp.net All Rights Reserved
更新时间:2025/5/18 0:53:05