我有以下格式的 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?