zoukankan      html  css  js  c++  java
  • JEECG datagrid 列表检索条件 添加下拉级联功能

    $("#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的概念。

    具体代码在

    orgjeecgframework agcoreeasyuiDataGridTag.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=" 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=" 104px"> ");
    									sb.append(StringUtil.replaceAll("<option value ="" >{0}</option>", "{0}", MutiLangUtil.getMutiLangInstance().getLang("common.please.select")));
    									for (Map<String, Object> map : list){
    
  • 相关阅读:
    xgqfrms™, xgqfrms® : xgqfrms's offical website of GitHub!
    xgqfrms™, xgqfrms® : xgqfrms's offical website of GitHub!
    xgqfrms™, xgqfrms® : xgqfrms's offical website of GitHub!
    xgqfrms™, xgqfrms® : xgqfrms's offical website of GitHub!
    xgqfrms™, xgqfrms® : xgqfrms's offical website of GitHub!
    xgqfrms™, xgqfrms® : xgqfrms's offical website of GitHub!
    xgqfrms™, xgqfrms® : xgqfrms's offical website of GitHub!
    xgqfrms™, xgqfrms® : xgqfrms's offical website of GitHub!
    JAVA后端开发规范
    IntelliJ IDEA配置
  • 原文地址:https://www.cnblogs.com/colmeluna/p/4720912.html
Copyright © 2011-2022 走看看