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){
    
  • 相关阅读:
    Python学习笔记捌——面向对象高级编程
    Python学习笔记五,函数及其参数
    Python学习笔记四,dict和set
    Python学习笔记三,数组list和tuple
    Python学习笔记一,输入输出
    Linux 环境下自动化测试工具,Redhat dogtail的安装
    Testlink接口使用方法-python语言远程调用
    Python入门学习之input()与raw_input()的区别
    从客户端(&)中检测到有潜在危险的 Request.Path 值解决方案
    树莓派嵌入式开发第一课笔记
  • 原文地址:https://www.cnblogs.com/colmeluna/p/4720912.html
Copyright © 2011-2022 走看看