zoukankan      html  css  js  c++  java
  • easyUI中onLoadSuccess方法获取多个对象

    后台将一个list中的对象循环放到map中,如下:

        @RequestMapping("/getSaleOrderDetailList")
        @ResponseBody
        public Map<String,Object>  getSaleOrderDetailList(Model model,HttpServletRequest request,HttpServletResponse response)
        {
    
            ... ...
    //新增时,复制订单 if(StringUtils.isNotBlank(copyId)){ SaleOrder copyOrder = saleOrderService.getById(copyId); if(copyOrder!=null){ List<SaleOrderDetail> copyList = saleOrderDetailService.getBySodNbr(copyOrder.getSoNbr()); resultMap.put("listCount", copyList.size());
              //这里循环将对象放到copyList+i中
    for(int i=0;i<copyList.size();i++){ resultMap.put("copyList" + i,copyList.get(i)); } } } return resultMap; }

    前台中获取对象,注意必须使用中括号将变量i和常量'copyList'放一起括括起来。

                 onLoadSuccess:function(data){
         //加载完成后,判断是否是新建订单复制订单
                    var num = data.listCount;
                    if(num > 0){
                        for(var i=0;i<num;i++){                
                            alert(data['copyList'+i]);   //这种正确:必须使用中括号来获取
    //                      alert(data.copyList+i);  这种写法是错误的,永远获取不到对象
                            copyOrder(data['copyList'+i]);
                        }
                    }
                },
  • 相关阅读:
    java中字符串类型的比较
    iOS 检测是否插入耳机
    Model-View-Controller (The iPhone Developer's Cookbook)
    Spring Animation
    CoreImage 自动增强滤镜 以及 系统滤镜查询
    UIView Animation
    CoreImage 查询系统滤镜
    CoreImage 的人脸检测
    Smarty 模板操作
    smarty转载(1)
  • 原文地址:https://www.cnblogs.com/30go/p/6243264.html
Copyright © 2011-2022 走看看