标签:
$("#communityId").change(
function(){
var id = $(this).children(‘option:selected‘).val(); //当前选择项的值
var url = "sUserorderController.do?getCampaign&comid=" + encodeURIComponent(encodeURIComponent(id));
$.ajax({
type : ‘POST‘,
url : url,
success : function(data) {
var d = $.parseJSON(data);
if (d.success) {
window.top.$.messager.progress(‘close‘);
$(‘#campaignId‘).html(d.msg);
}
}
});
});

首先是
为小区这个下拉选项添加 onchange事件,当点选communityId元素下拉事件时,通过ajax查询第二级select选择框内的值。(这里的actoin是sUserorderController.do?getCampaign )。
jeecg 默认的标签 ,query="true" model="single" 增加的检索项是不带ID的,不过原理一样。 可以根据name获取dom元素。亦或修改jeecg源代码,为检索项添加id的概念。
具体代码在
org\jeecgframework\tag\core\easyui\DataGridTag.java
只需要为select 增加 id 即可。
if("single".equals(col.getQueryMode())){
if(!StringUtil.isEmpty(col.getReplace())){
sb.append("<select id=\""+col.getField().replaceAll("_","\\.")+"\" name=\""+col.getField().replaceAll("_","\\.")+"\" WIDTH=\"100\" style=\"width: 104px\"> ");
sb.append(StringUtil.replaceAll("<option value =\"\" >{0}</option>", "{0}", MutiLangUtil.getMutiLangInstance().getLang("common.please.select")));
String[] test = col.getReplace().split(",");
String text = "";
String value = "";
for (String string : test) {
String lang_key = string.split("_")[0];
text = MutiLangUtil.getMutiLangInstance().getLang(lang_key);
value =string.split("_")[1];
sb.append("<option value =\""+value+"\">"+text+"</option>");
}
sb.append("</select>");
}else if(!StringUtil.isEmpty(col.getDictionary())){
if(col.getDictionary().contains(",")){
String[] dic = col.getDictionary().split(",");
String sql = "select " + dic[1] + " as field," + dic[2]
+ " as text from " + dic[0];
systemService = ApplicationContextUtil.getContext().getBean(
SystemService.class);
List<Map<String, Object>> list = systemService.findForJdbc(sql);
sb.append("<select id=\""+col.getField().replaceAll("_","\\.")+"\" name=\""+col.getField().replaceAll("_","\\.")+"\" WIDTH=\"100\" style=\"width: 104px\"> ");
sb.append(StringUtil.replaceAll("<option value =\"\" >{0}</option>", "{0}", MutiLangUtil.getMutiLangInstance().getLang("common.please.select")));
for (Map<String, Object> map : list){
JEECG datagrid 列表检索条件 添加下拉级联功能
标签:
原文地址:http://www.cnblogs.com/colmeluna/p/4720912.html