我的 JSON 存储(django Rest 框架)返回“count”、“next”、“previous”和“results”的键。
“count”是可用的行数。
“下一页”是下一页结果的 URL(例如 ids 26-50)。
“previous” 是上一页结果的 url(在本例中为 null,因为这是结果的第一页)。
“结果”键包含我想要在 OnDemandGrid 中显示的实际数据对象。
如何将“结果”关键数据集合连接到网格?提前谢谢你的帮助。
返回的 JSON ( collection: new Rest({target: '/api/events'?format=json'),}) )如下所示:
{
"count":1411,
"next":"http://localhost/api/events/?format=json&page=2",
"previous":null,
"results": [
{"id":1,"event_type":"02","event_at":"2015-03-31T12:53:41Z","machine_id":1,"revs":4342,"color":5,"heads_info":"using http","tag":1,"hidden":false},
{"id":2,"event_type":"02","event_at":"2015-03-31T12:53:41Z","machine_id":1,"revs":4342,"color":5,"heads_info":"using http","tag":1,"hidden":false},
...
{"id":25,"event_type":"02","event_at":"2015-03-31T12:54:01Z","machine_id":1,"revs":4342,"color":5,"heads_info":"using http","tag":1,"hidden":false},
]
}