【发布时间】:2012-07-20 19:35:16
【问题描述】:
我有以下格式的 JSON:
{
"id": 1,
"arbitraryAttribute": "arbitraryValue",
"thing": {
"thingKey1": "thingValue1",
"thinkKey2": "thingValue2"
}
}
这个模型是这样表示的:
Ext.define("MyModel", {
extends: "Ext.data.Model",
fields: [
{name: "id", type: "string"},
{name: "arbitraryAttribute", type: "string"},
],
hasOne: [
{
model: "Thing",
name: "thing"
}
]
});
Ext.define("Thing", {
extends: "Ext.data.Model",
fields: [
{name: "thingKey1", type: "string"},
{name: "thingKey2", type: "string"}
]
});
代理是一个简单的 json 代理。它得到的 JSON 看起来像我展示的那样,但我的记录似乎不知道 Thing 模型。是否需要设置任何额外的管道才能让 MyModel 提取嵌套的 Thing json?
【问题讨论】: