jQuery MiniUI

 找回密码
 立即注册
查看: 2855|回复: 1
打印 上一主题 下一主题

JSON数据嵌套的问题!!! [复制链接]

Rank: 1

跳转到指定楼层
楼主
发表于 2017-9-21 19:18:13 |只看该作者 |倒序浏览
您好,请问,如何解决JSON嵌套的问题,怎么把数据获取出来呢??
JSON:
  1. [{"supplierList":[{"id":2,"supplierId":"XYD-xydxyd","supplierName":"xydxyd","supplierContacts":null,"supplierCall":null,"supplierAddress":null,"remarks":""}],"typeList":[{"id":2,"typeId":null,"typeNum":"WL-001","typeName":"散热器WL-001","typeDesc":null}],"id":2,"partsSummary":"","partsDanhao":"XYD-WLRK-2017919-002","supplierId":"XYD-xydxyd","typeNum":"WL-001","partsName":"123","unit":"个","buycounts":123,"sellcounts":1,"flag":"1","date":"2017-09-19 18:07:13","remarks":""},{"supplierList":[{"id":4,"supplierId":"XYD-xydxyd","supplierName":"xydxyd","supplierContacts":null,"supplierCall":null,"supplierAddress":null,"remarks":"321"}],"typeList":[{"id":4,"typeId":null,"typeNum":"WL-001","typeName":"散热器WL-001","typeDesc":null}],"id":4,"partsSummary":null,"partsDanhao":"XYD-WLCK-2017920-001","supplierId":"XYD-xydxyd","typeNum":"WL-001","partsName":"123","unit":"个","buycounts":1,"sellcounts":-321,"flag":"2","date":"2017-08-20 11:46:54","remarks":"321"},{"supplierList":[{"id":5,"supplierId":"XYD-IBM","supplierName":"IBM","supplierContacts":null,"supplierCall":null,"supplierAddress":null,"remarks":"测试你能如何!"}],"typeList":[{"id":5,"typeId":null,"typeNum":"WL-001","typeName":"散热器WL-001","typeDesc":null}],"id":5,"partsSummary":null,"partsDanhao":"XYD-WLCK-2017920-002","supplierId":"XYD-IBM","typeNum":"WL-001","partsName":"中央处理散热器","unit":"台","buycounts":1,"sellcounts":100,"flag":"2","date":"2017-09-20 15:17:19","remarks":"测试你能如何!"}]
复制代码
字段::
  1. <div field="typeName" width="100" headerAlign="center" renderer="getType" allowSort="true">类别</div>
复制代码
function我了创建了,但是没效果::
  1. function getType(value) {
  2.                 alert(value.typeNum);
  3.                 return value.typeNum;
复制代码
大神,帮我一下啊!!!谢谢!!!

Rank: 8Rank: 8

沙发
发表于 2017-9-22 09:25:46 |只看该作者
我们getType默认参数是e。你这里要显示什么?
你这value又是什么?你这列field=“typeName",你的数据里面都没有typeName字段,显示什么?

Archiver|普加软件

GMT+8, 2024-11-23 03:50 , Processed in 1.034530 second(s), 10 queries .

Powered by Discuz! X2

© 2001-2011 Comsenz Inc.

回顶部