【发布时间】:2012-03-02 14:00:22
【问题描述】:
当我从 json 解析这些值时,Extjs 的网格中的值变为空,这基本上是因为属性标签带有点。
"properties": {
"financialYear": "2009",
"employee.employeeId": "12345",
"employee.employeeName": "abc"
}
如何让 .js 中的 employee.employeeId 值显示在 Extjs 网格中。
现在我在 .js 中像这样映射,
Ext.define('DocProperties',{
extend: 'Ext.data.Model',
fields: [
{name: 'financialYear', type: 'string'},
{name:'employeeId', mapping:'properties.employee.employeeId',type: 'string'},
]});
为了在网格面板中显示,我正在像这样访问,
{
width:100,
header: "Employee ID",
dataIndex: 'employeeId',
sortable: true
}
任何解决方案或解决方法。
@DmitryB 谢谢,但这并没有解决我的问题,我有这样的商店
Ext.onReady(function() {
var store = Ext.create('Ext.data.Store', {
model: 'DocResult',
autoLoad: true,
proxy: {
type: 'rest',
url : 'sample-data.json',
reader: {
type: 'json',
root: 'results',
useSimpleAccessors: true
}
}
});
在我的模型中我是这样定义的
Ext.define('DocResult',{
extend: 'Ext.data.Model',
fields: [
{name: 'id', type: 'int'},
{name:'employeeId', mapping:'properties.employee.employeeId',type: 'string'}
] });
然后在我的 Ext 网格中也显示空值。请帮助。
【问题讨论】: