在list页面双击显示重叠明细

页面为table标签(双击显示,隐藏,并且只会提交一次数据库)
效果:这里写图片描述
实现:
(1)页面
这里写图片描述

<tr   details_url="/appdata_manage/DealerMostly/sfPosNum?dm_num=${(list.DM_NUM)!}" class="details"  promptid="${(list.DM_NUM)}" > 

(2)js

$(".details").live("dblclick",function(){
    var mytr=$(this);
    if(mytr.next().attr("class")=="details_info"){
        mytr.next().toggle();
    }else{
        var url=mytr.attr("details_url");
        var html=" <tr class='details_info' ><td style='background-color:#FFE7BA;' colspan="+mytr.children().size()+"> ";
        $.ajax({
          url:url,
          type:"get",
          success:function(data){
             for(var key in data)  {
             html+="<label style='padding-right: 20px'>"+key+":"+data[key]+"</label>";
             }
             html+="</td></tr>";
             mytr.after(html);
          }
        });
    }

});

(3) 后台

     @RequestMapping("/selectBusinessName")
     public @ResponseBody Map consumptionInfo() {
        Map map=new HashMap();
        map.put("agent_num", getUsers().getAgent_num());
        map.put("serial", getParameter("serial"));
        map=(Map) formalPosService.selectOne("selectBusinessName", map);
        Map result=new HashMap();
        result.put("商户名称", map.get("BUSINESS_NAME"));
        result.put("商户编号", map.get("DM_NUM"));
        return result;
     }  

后台代码大概就查询拼接一下, 意思就是这个意思,自由发辉

猜你喜欢

转载自blog.csdn.net/qq_25384901/article/details/75349533
今日推荐