【发布时间】:2018-09-25 05:59:15
【问题描述】:
我有存储在一个对象中的 JSON 数据。
现在我必须在网格视图中的 UI 上显示数据。当我点击按钮时,应该会打开一个新窗口,在该窗口中将显示 JSON 数据。
我无法迭代 JSON 并将数据放入网格视图中。
这是我的代码
var data = response.responseText;
var win = new Ext.Window({
modal : true,
height: 410,
width: 700,
style: 'background: #fff',
insetPadding: 60,
closable : true,
closeAction : 'destroy',
title : 'API Usage',
autoScroll : true,
buttonAlign : 'center',
items: //What should I write?
}]
}).show();
我的 json 数据
[
"list",
[
{
"apiName": "List",
"action": "GET",
"count": 24
},
{
"apiName": "Test",
"action": "GET",
"count": 8
}
]
]
谁能帮助我如何迭代这个 JSON 数据并将数据放入 extJS 中的这个新窗口中?
【问题讨论】:
-
你必须设置一个 store 才能将 json 数据绑定到网格:docs.sencha.com/extjs/4.2.2/#!/api/Ext.data.Store
-
@Sharvil 更新示例。
标签: javascript extjs extjs4 sencha-touch extjs4.2