You found a bug! We've classified it as
EXTJS-14222 .
We encourage you to continue the discussion and to find an acceptable workaround while we work on a permanent fix.Loading of OneToMany association with session does not work.
Loading of OneToMany association with session does not work.
First grid in fiddle loads association ok, second one not: http://ift.tt/1ClLouP
ExtJs version: 5.1.0.107
Code:
Ext.define('BaseModel', {
extend: 'Ext.data.Model',
schema: {
urlPrefix: '/data',
proxy: {
type: 'rest',
url: '{prefix}/{entityName:lowercase}',
reader: {
type: 'json',
rootProperty: 'data'
}
}
}
});
Ext.define('User', {
extend: 'BaseModel',
fields: ['id', 'name', {
name: 'groupId',
reference: 'Group'
}]
});
Ext.define('Group', {
extend: 'BaseModel',
fields: ['id', 'name']
});
Ext.define('UsersGrid', {
xtype: 'usersgrid',
extend: 'Ext.grid.GridPanel',
forceFit: true,
border: 1,
fields: ['id', 'groupname'],
columns: [{
dataIndex: 'id',
text: 'id'
}, {
dataIndex: 'name',
text: 'name'
}]
});
Ext.onReady(function() {
var session=Ext.create('Ext.data.Session');
var vp=Ext.create('Ext.container.Viewport', {
layout: {
type: 'vbox',
align: 'stretch',
pack: 'start'
},
items: [{
flex: 1,
number: 1,
viewModel: {
links: {
group: { type: 'Group', id: 1 }
}
},
bind: {
title: '{group.name}'
},
items: [{
xtype: 'usersgrid',
bind: '{group.users}'
}]
}, {
flex: 1,
number: 2,
session: session, // <--- We added session here !!!!
viewModel: {
links: {
group: { type: 'Group', id: 1 }
}
},
bind: {
title: '{group.name}'
},
items: [{
xtype: 'usersgrid',
bind: '{group.users}'
}]
}]
});
});
Evan Trimboli
Sencha Developer
Twitter - @evantrimboli
Don't be afraid of the source code!
Loading of OneToMany association with session does not work.
Aucun commentaire:
Enregistrer un commentaire