后台将一个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]);
}
}
},

easyUI中onLoadSuccess方法获取多个对象的更多相关文章

  1. 使用jquery中height()方法获取各种高度大全

    alert($(window).height()); //浏览器当前窗口可视区域高度 alert($(document).height()); //浏览器当前窗口文档的高度 alert($(docum ...

  2. 关于SessionFactory的不同实现类分别通过getCurrentSession()方法 和 openSession() 方法获取的Session对象在保存对象时的一些区别

    一.单向多对一关联关系 一).使用LocalSessionFactoryBean类,即在applicationContext中配置的 <!-- 配置SessionFactory 使用LocalS ...

  3. [Web 前端 ] Jquery attr()方法 获取或修改 对象的属性值

    cp from : https://blog.csdn.net/gf771115/article/details/18086707 jquery中用attr()方法来获取和设置元素属性,attr是at ...

  4. Swing组件中URL方法获取 图标

    13.3.2 图标的使用 1.创建图标 package lll; import java.awt.*; import javax.swing.*; public class DrawIcon impl ...

  5. Jquery中css()方法获取边框长度

    1. JQuery中可以使用css()方法获取块元素的边框宽度,如下: $("divMode").css("border-left-width");//左边框长 ...

  6. idea和eclipse中getAbsolutePath()方法获取值不同

    项目中,使用嵌入式tomcat启动web工程(具体使用请度娘,关键字: tomcat embeded) 启动时,设置tomcat path的代码如下: Embedded tomcat = new Em ...

  7. jQuery中serializeArray方法的使用及对象与字符串的转换

    使用jQuery中的serializeArray()方法可以方便的将表单中的各个信息,转化为多个{name:xx,value:xx}对象的数组, 再使用遍历的方式可以方便的将数组转化为json对象, ...

  8. EasyUI的onLoadSuccess方法

    EasyUI加载表单的时候,对表单内行数据进行判断,可以赋颜色,也可以进行其他操作 onLoadSuccess:function(data) { for(var i=0;i<data.rows. ...

  9. easyUI中datagrid控制获取指定行数的数据

    直接上代码: var rows=$('#detail').datagrid('getRows');//获取所有当前加载的数据行 var row=rows[0];// 行数从 0 开始 项目中代码: v ...

随机推荐

  1. 【译】什么是 web 框架?

    Web 应用框架,或者简单的说是“Web 框架”,其实是建立 web 应用的一种方式.从简单的博客系统到复杂的富 AJAX 应用,web 上每个页面都是通过写代码来生成的.我发现很多人都热衷于学习 w ...

  2. codevs 1082 线段树练习 3(区间维护)

    codevs 1082 线段树练习 3  时间限制: 3 s  空间限制: 128000 KB  题目等级 : 大师 Master 题目描述 Description 给你N个数,有两种操作: 1:给区 ...

  3. ns3 print 丢包内容的两种方法

    1.方法一enable ascii print AsciiTraceHelper ascii; pointToPoint.EnableAsciiAll (ascii.CreateFileStream ...

  4. [LeetCode] Perfect Rectangle 完美矩形

    Given N axis-aligned rectangles where N > 0, determine if they all together form an exact cover o ...

  5. [LeetCode] Bulb Switcher 灯泡开关

    There are n bulbs that are initially off. You first turn on all the bulbs. Then, you turn off every ...

  6. [LeetCode] Best Meeting Point 最佳开会地点

    A group of two or more people wants to meet and minimize the total travel distance. You are given a ...

  7. [LeetCode] Binary Search Tree Iterator 二叉搜索树迭代器

    Implement an iterator over a binary search tree (BST). Your iterator will be initialized with the ro ...

  8. [LeetCode] Decode Ways 解码方法

    A message containing letters from A-Z is being encoded to numbers using the following mapping: 'A' - ...

  9. mybatis generator maven插件自动生成代码

    如果你正为无聊Dao代码的编写感到苦恼,如果你正为怕一个单词拼错导致Dao操作失败而感到苦恼,那么就可以考虑一些Mybatis generator这个差价,它会帮我们自动生成代码,类似于Hiberna ...

  10. DrawerLayout 和 NavigationView 的使用

    参考: 1.NavigationView 的使用 2.NavigationView更改菜单icon和title颜色变化效果 3.Android 自己实现 NavigationView 转了第一篇   ...