Я пытаюсь отобразить информацию о модели в сетке, но она не отображает информацию об эталонной модели.
Моя образцовая личность
Ext.define('Myapp.model.Person',{
extend: 'Ext.data.Model',
idPropery: 'dni',
fields: [
"dni",
{name:'age', type: 'int'},
{name:'names', type: 'string'}
]
});
Моя рабочая модель:
Ext.define('Myapp.model.Worker',{
extend: 'Ext.data.Model',
idPropery: 'idWorker',
fields: [
"idWorker",
{name:'salary', type: 'int'},
{name: 'personId', reference: 'Person', unique:true}
]
});
Мой магазин:
Ext.define('Myapp.store.Worker',{
extend: 'Ext.data.Store',
alias: 'sworker',
model: 'Myapp.model.Worker',
autoLoad: true,
proxy: {
type: 'ajax',
api: {
read: 'allWorkers'
},
reader: {
type: 'json',
rootProperty: 'data',
totalProperty: 'total'
}
}
});
Мой формат json:
data: [
{"idWorker":'COD0001',"salary":2700,"person":{"dni":"57547854", "age": 22, "names": "Diana"}},
{"idWorker":'COD0002',"salary":1700,"person":{"dni":"00257854", "age": 27, "names": "Carlo"},
{"idWorker":'COD0003',"salary":5000,"person":{"dni":"54787854", "age": 18, "names": "Pedro"},
{"idWorker":'COD0004',"salary":1800,"person":{"dni":"57547854", "age": 30, "names": "Ramon"}
],
total: 4
Моя сетка:
Ext.define('Myapp.view.worker.WorkerList', {
extend: 'Ext.grid.Panel',
xtype: 'workerList',
store: {
type: 'sworker'
},
columns: [
{text: 'My code', dataIndex: 'idWorker'},
{text: 'Names ', dataIndex: 'names'},
{text: 'Age ', dataIndex: 'age'},
{text: 'Salary ', dataIndex: 'salary'}
],
dockedItems: [{
xtype: 'pagingtoolbar',
dock: 'bottom',
displayInfo: true
}]
});
Приведенный выше код не отображает «имена», «возраст». Так что я сделал некоторые изменения.
columns: [
{text: 'My code', dataIndex: 'idWorker'},
{text: 'Names ', xtype: 'templatecolumn', tlp: '{person.names}'},
{text: 'Age ', xtype: 'templatecolumn', tlp: '{person.age}'},
{text: 'Salary ', dataIndex: 'salary'}
]
но теперь не работает порядок «имя» и «возраст». Кто-нибудь может мне помочь, пожалуйста.