freemark动态加载列表数据
2017-03-17 17:00
337 查看
1.ftl页面中 <table class="table table-striped table-hover table-bordered" name="record" id="editable-sample"> </table> function pay_details(game_id){ $("[name='record']").html(""); //获取上面table的name,清空table $.post('${basePath}/agency/pay_details.shtml',{ "game_id":game_id },function(result){ var html_=""; var html__=""; html_=html_+ "<thead >"+ "<tr>"+ "<th>游戏ID</th>"+ "<th>充值人</th>"+ "<th>游戏用户名</th>"+ "<th>金额</th>"+ "<th>兑换率</th>"+ "<th>充值金币</th>"+ "<th>订单号</th>"+ "<th>充值时间</th>"+ "<th>支付状态</th>"+ "<th>充值状态</th>"+ "<th>充值类型</th>"+ "</tr>"+ "</thead>"; $.each(result, function(idx, obj) { html__=html__+ "<tr>"+ "<td>"+obj.GameID+"</td>"+ "<td>"+obj.TrueName+"</td>"+ "<td>"+obj.UserName+"</td>"+ "<td>"+obj.PayMoney+"</td>"+ "<td>"+obj.ExchangeRate+"</td>"+ "<td>"+obj.InMoney+"</td>"+ "<td>"+obj.OrderID+"</td>"+ "<td>"+obj.AddTime+"</td>"+ "<td>"+(obj.PaySuccess=='true'? '已支付' :'未支付')+"</td>"+ "<td>"+(obj.InSuccess=='true'? '已充值' : '未充值')+"</td>"+ "<td>"+obj.TypeInfo+"</td>"+ "</tr>"; }); $("[name='record']").html(html_+html__);//把固定行和动态遍历的行加载到table中 }); } 2.controller中提供List数据 @RequestMapping(value = "pay_details", method = RequestMethod.POST) @ResponseBody public List<Map<String, String>> pay_details(HttpServletRequest request) { List<Map<String, String>> si = new ArrayList<Map<String, String>>(); if (request.getParameter("game_id") != null && request.getParameter("game_id") != "") { // 发送 POST 请求 String game_id = request.getParameter("game_id").toString(); String sr = RequestService.sendPost(InterfaceAddressConfig.get("GetOrderList"), "game_id="+ game_id + "&pageSize=900000&pageIndex=1");// 请求充值成功的conditions=1为充值成功,每页90w条 HashMap<String, String> stringToMap = StringToMap.StringToMap(sr); if (!"[]".equals(stringToMap.get("list").toString())) { String replace = stringToMap.get("list").toString().replace("[", "").replace("]", ""); String[] arr = replace.split("\\},\\{"); List<String> list = java.util.Arrays.asList(arr); for (String list_ : list) { String lists = "{" + list_.replace("{", "").replace("}", "") + "}"; System.out.println(lists); HashMap<String, String> itemMap = StringToMap.StringToMap(lists); si.add(itemMap); } } } return si; }
相关文章推荐
- Android列表组件ListView使用详解之动态加载或修改列表数据
- easyui 下拉列表如何动态加载数据
- [转]以列表形式显示动态加载的数据(JavaScript,Java,JSP,HTML)
- 以列表形式显示动态加载的数据
- 下拉列表数据动态加载 springmvc jquery ajax
- 在jquery mobile制作app的几个页利用ajax将后台数据json数组动态加载到列表里面
- 在基于Ext的Efs框架下动态加载数据列表Grid
- Ext.grid.EditorGridPanel单元格内套用下拉列表,且列表数据为动态加载,支持模糊查询,有描述信息
- listview动态加载数据,并更新数据列表
- 水晶报表动态加载数据
- AppDomain 动态加载及数据交互
- 将数据对象加载到下拉列表中
- 关于asp.net ajax中的accordion动态加载数据
- 全国各省市联动下拉列表(异步动态加载)
- 全国各省市联动下拉列表(异步动态加载) (转载)
- html中的数据岛:利用DSO和javascript在html中动态加载和浏览xml数据
- 使用JSON来做数据传输的动态下拉列表
- Ext Grit动态加载xml数据
- 使用Ajax动态加载数据
- wince动态加载图片,数据类型转换