Hello all,
I have the follow model, but when I try to get the data of PI I got an empty set back. I have the same problem in one of my controllers. Using a mapping to PI.suts works fine, but I need also the first item from PI.p
PHP Code:
Ext.define('app.model.Artikel', {
extend: 'Ext.data.Model', config: {
fields: [
{
name: 'Nr',
type: 'int'
},
{
name: 'Nm',
type: 'string'
}, {
name: 'Test',
type: 'String',
mapping: 'PI.suts' //THIS WORKS FINE!!
},
{
name: 'Sample',
convert: function(v, record) {
//return record.PI() the length off data is 0
//how to get the first p from PI
}
}
],
hasMany: {
name: 'PI',
model: 'app.model.EenheidInformatie'
}
}
The model using for the hasMany
PHP Code:
Ext.define('iperenMobile.model.EenheidInformatie', {
extend: 'Ext.data.Model',
config: {
fields: [
{
name: 'sut',
type: 'string'
},
{
name: 'suts',
type: 'string'
},
hasMany: {
name: 'p',
model: 'app.model.Eenheid'
}
],
}});
PHP Code:
Snippet from controller
onSomeListTap: function(list, record){
var data = record.raw.Products; //array using in a list
//here record.Products() data array is empty
}
What is going wrong with the hasMany fields in the model, what I'm doing wrong? I hope you understand what I mean. It's hard to me to explain and write it down in readable English.
Thanks,
Gertjan