Extjs 二级联动
来源:互联网 发布:秦朝是如何灭亡的 知乎 编辑:程序博客网 时间:2024/06/01 07:30
1级下拉框
后台回去参数:
vargetRootDataJsonStore = new Ext.data.JsonStore(
{ //填充的数据
url : REQUEST_URL_BASE + "dataOutPollHandler/getRootData",
fields : new Ext.data.Record.create( [
'wbjjc'])
});
new Ext.FormPanel的1级下拉框:
{
xtype : 'combo',
fieldLabel : '<span style="color:red;font-size:13pt;">*</span>委办
width : 110,
allowBlank : false,
editable : false,
mode : 'local',
hiddenName : 'addwbjbm',
id : "addFormWBJNameId",
store :getRootDataJsonStore,
triggerAction : 'all',
displayField : 'wbjjc',// 定义要显示的字段
//valueField : 'wbjbm',// 定义值字段
forceSelection : true,// 要求输入值必须在列表中存在
resizable : true,// 允许改变下拉列表的大小
typeAhead : true,// 允许自动选择匹配的剩余部分文本
blankText : '请选择委办局',
handleHeight : 10
}
最后面需要跟上这么一句话:
Ext.getCmp('addFormWBJNameId').store.load();
二级菜单及store参数
在js最上面设置全局变量:
var changeUrl=REQUEST_URL_BASE + "dataOutPollHandler/xxlmcList";
new Ext.FormPanel的2级下拉框:
{
xtype : 'combo',
fieldLabel : '<span style="color:red;font-size:13pt;margin-left:-3px;">*</span>信息类名称',
allowBlank : false,
editable : false,
width : 110,
hiddenName : 'dataInfo',
mode : 'local',
id : 'dataInfoId',
store : new Ext.data.JsonStore(
{ //填充的数据
url :changeUrl,
async: false,//同步
fields : new Ext.data.Record.create( ['xxlmc' ])
}),
triggerAction : 'all',
displayField : 'xxlmc',
//valueField : 'id',// 定义值字段
forceSelection : true,// 要求输入值必须在列表中存在
resizable : false,// 允许改变下拉列表的大小
typeAhead : true,// 允许自动选择匹配的剩余部分文本
blankText : '请选择信息类名称',
handleHeight : 10
}
设置2级联动(意思是点击1级菜单2级菜单开始加载数据,通过URL传递wbjjc参数到后台):
Ext.getCmp("addFormWBJNameId").on('select',function(){
Ext.getCmp("dataInfoId").setValue('');
var wbjjc = Ext.getCmp("addFormWBJNameId").getValue();
var store=Ext.getCmp("dataInfoId").getStore();
store.load({
async: false,
params: {wbjjc:wbjjc}
});
});
后台处理代码:
public String xxlmcList(Model model) throws UnsupportedEncodingException {
String wbjjc=model.getValue("wbjjc");
List<String>xxlmcList=dataOutPollService.xxlmcList(model, wbjjc);
CreateJson json = new CreateJson();
for (int i = 0; i < xxlmcList.size(); i++) {
json.add("xxlmc", xxlmcList.get(i));
json.addToList();
}
return json.getResultJson();
}
根据大家的习惯可以自己设置后台代码
用于借鉴。
- ExtJs Combobox 二级联动
- Extjs二级联动
- Extjs二级联动
- Extjs 二级联动
- Extjs实现二级联动
- ExtJs combo的二级联动
- ExtJs combo的二级联动
- 关于extjs的下拉框二级联动
- 二级联动
- 二级联动
- 二级联动
- 二级联动
- 二级联动
- 二级联动
- 二级联动
- 二级联动
- 二级联动
- 二级联动
- DRBD+Heartbeat+NFS高可用图文实操
- 解决易语言程序Not found the kernel library or the kernel library is invalid问题
- Mysql主从复制
- JS检测用户使用哪种浏览器
- 指南
- Extjs 二级联动
- Android Support Library
- HTML CSS学习历程
- linux常用命令
- CodeForces 625B War of the Corporations(KMP)
- Spark和Anaconda结合
- http://blog.csdn.net/sinyu890807/article/details/51933728
- springboot maven filter写入properties文件
- linux redis安装