2015-12-29 11:31题主

用dataProvider获取数据并返回type为jsonArray,如何用js取到以"["开头的rows的内容呢?

 利用dataProvider查询数据库,设置type为jsonArray,执行完查询后,生成数据格式为:
{"total":20,"success":true,"metaData":{"fields":[{"name":"name","type":"string"},{"name":"id","type":"int"},……]},"rows":[{"name":"领导班子","id":1,"pId":0,"open":"false"},{"name":"综合部","id":2,"pId":0,"open":"false"},……,{...}],"processedTime":16}

怎么样用js取到以"["开头的rows的内容呢?类型是jsonArray吗?还要转换什么的吗?
[{"name":"领导班子","id":1,"pId":0,"open":"false"},{"name":"综合部","id":2,"pId":0,"open":"false"},……,{...}]



2015-12-29 21:03#1
Wb.decode后获得json对象,取json.rows就可以获得你要的数据
2016-01-07 16:24#2
要取其中某一列的值,直接Ext.decode(r.responseText).rows.name 能取到”领导班子“吗?
2016-01-07 18:22#3
Ext.decode(r.responseText).rows[0].name就是领导班子
2016-01-13 11:17#4
rows[0]是什么对象呢?
2016-01-21 17:23#5
返回json表格数据的第一行记录

返回开发者社区