0
商店:Ext JS的数据转换
Ext.define('firstApp.store.school', {
model: 'School',
root: 'children',
proxy: {
type: 'ajax',
url: 'http://localhost/firstApp/app/data/school.json',
reader: {
type: 'json'
}
},
autoLoad: true
});
型号:
Ext.define('School', {
extend: 'Ext.data.Model',
fields: [
{name: 'text', type: 'string'}
]
});
JSON:
{
"success": true,
"children": [
{"firstName": "Phil", "lastName": "Potato", "leaf": true },
{"firstName": "Nico", "lastName": "Potato", "expanded": true, "children": [
{"firstName": "Mitchell", "lastName": "Potato", "leaf": true }
]},
{ "firstName": "Sue", "lastName": "Potato", "leaf": true }
]
}
我希望将数据从我的JSON文件I转换nto学校模型,使模型中的text
等于来自JSON的firstName + lastName
。最近搜索了一些信息,但没有找到任何帮助。你能帮我解决这个问题吗?
谢谢!已经想通了:) –