EasyUI ComboGrid组件,分页、多选回显的时候无法选中

描述:

          因为combogrid据表格下拉框结合了可编辑文本框控件和下拉数据表格面板控件,该控件允许用户快速查找和选择,并且带有分页,当选中的数据在第二页的时候,初始化加载会出现无法选中的情况 
解决思路:

         把选中的数据,在修改页面加载的时候尽量放在第一页

前台:

$('#custId').combogrid({
					url:"${g.createLinkTo(dir:'businessDpartment',file:'getdata')}?pdata=${result.custId}",
					height:28,
					panelWidth: 480,
					panelHeight:400,
					editable:false,
					pageSize:1000,
					idField: 'cust_id',
					textField: 'ch_name',
					required:true,
					multiple:true,
					pagination:true,
					editable:false,
					fitColumns:true,
					toolbar:"<div style='padding:5px;'>客户编号/名称:<input type='text' id='searchValue' style='padding:3px;border:1px solid #CCC;'/>&nbsp;&nbsp;<img src='/cbs/js/jquery-easyui-1.3.2/themes/icons/search.png' style='margin-bottom:-4px;cursor:pointer;' title='搜索' onclick=seachgrid('custId','cust_no','ch_name')></div>",
					columns:[[
						{field:'cust_no',title:"客户编号",width:120,align:"center",sortable:false},
						{field:'ch_name',title:"客户中文名",width:120,align:"center",sortable:false},
					]],
					onLoadSuccess:function(data){
						var map={};
						var res0="${result.custId}";
						var res1= res0.split(",");
						console.log(res1);
						console.log(res0);
						$("#custId").combogrid('setValues',res1)
					}
				});

 

后台:

def getdata(){
        def sql=new Sql(dataSource)
        def cons = []
        def wheresql = ""
        def chName=BaseUtil.checkNull(params["chName"]);
        def searchValue=BaseUtil.checkNull(params.searchValue)
        def pdata = BaseUtil.checkNull(params["pdata"]);
        def pIds=[]
        if(chName){
            wheresql=" and ch_name like ? ";
            cons.push('%'+chName+'%')
        }
        if(searchValue){
            wheresql=" and  (cust_no like ? or  ch_name like ?)";
            cons.push('%'+searchValue+'%')
            cons.push('%'+searchValue+'%')
        }
        def sb=new StringBuffer()
        if(pdata!=""){
            pdata.split(",").each {
                def String=
                sb.append("'${it.toString().trim()}'")
                sb.append(",")
            }
            sb.delete(sb.lastIndexOf(","),sb.lastIndexOf(",")+1)
            wheresql=" and a.cust_id not in ("+sb.toString()+") "
        }
        def sqlp = []
        sqlp.addAll(cons)
        def sqlt = "select count(cust_id) rowtotal from pctm_sys_cust  a where del_flag='0'"+wheresql
        def sqld = """
			select a.cust_id,a.cust_no,a.ch_name,a.created_stamp from pctm_sys_cust a 
			left outer join sys_dic d on d.dic_type='3004' and a.cust_no=d.dic_value
			where a.del_flag='0'
		"""+wheresql
        def results=page(sqlt,sqld,sqlp,"created_stamp",[:])
        if(pdata && params.page=="1"){
            def sql1="""select a.cust_id,a.cust_no,a.ch_name from pctm_sys_cust a 
                                    left outer join sys_dic d on d.dic_type='3004' and a.cust_no=d.dic_value
                                    where a.del_flag='0' and a.cust_id in ( """+sb.toString()+""" )"""
            def chIds=sql.rows(sql1)
            def arrs=new ArrayList()
            arrs.addAll(chIds)
            arrs.addAll(results.rows)
            results.rows=arrs
        }
        render results as JSON
    }

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值