Hello,
In a List view, i display an object containing associated data
this record is an 'Event' which has many 'Tasks' which has many 'dental_task_event'
Event
|_ Tasks
|_ dental_task_event
my problem is that now after the upgrade to 2.1 the tasks are multiplied in my store, while in 2.03 that was working well
here's my Event model
Code:
Ext.define('CWFSE.model.Event_evt', {
extend: 'Ext.data.Model',
requires: ['CWFSE.model.Task','CWFSE.model.DentalEvt'],
config: {
idProperty: 'EVT_ID',
identifier: 'uuid',
fields: [
{name: "EVT_ID", type: "int"},
{name: "USR_ID", type: "int"},
{name: "CON_ID", type: "int"},
{name: "EVT_TYPE", type: "string"},
{name: "EVT_NAME", type: "string"},
{name: "EVT_START", type: "string"},
{name: "EVT_END", type: "string"},
{name: "EVT_MSG", type: "string"},
{name: "EVT_COLOR", type: "string"},
{name: "EVT_STATE", type: "string"}
],
associations: [
{type:'hasMany', model:'CWFSE.model.Task', name: 'tasks', associationKey:'tasks'},
]
}
});
my tasks model
Code:
Ext.define('CWFSE.model.Task', {
extend: 'Ext.data.Model',
config: {
identifier: 'uuid',
fields: [
{name: "ETK_ID", type: "int"},
{name: "EVT_ID", type: "int"},
{name: "ETK_NAME", type: "string"},
{name: "ETK_POS", type: "string"},
{name: "ETK_DURATION", type: "string"},
{name: "ETK_AMOUNT", type: "string"},
{name: "ETK_MSG", type: "string"}
],
associations: [
{type:'hasMany', model:'CWFSE.model.DentalEvt', name: 'dental', associationKey:'dental'}
]
}
});
my events are loaded by a JsonP call,
Code:
Ext.define('CWFSE.store.Event_evts', {
extend: 'Ext.data.Store',
requires: ['CWFSE.model.Event_evt'],
xtype:'EventStore',
config: {
model: 'CWFSE.model.Event_evt',
storeId: 'eventActe',
autoLoad: true,
proxy: {
type: 'jsonp',
url: 'http://192.168.0.34/php/erwann/events.php?id=5',
callbackKey: 'callback',
id : 'eventProxy',
reader: {
type: 'json',
rootProperty:'events'
}
}
}
});
and my tasks are feeded with this part of code
Code:
fn: function(view, index, item, e){
var rec = view.getStore().getAt(index);
console.log(rec.get('tasks'));
var mysheet = new Ext.Sheet(
{
height:400,
layout:'vbox',
stretchX:true,
items:[
{
xtype:'list',
layout:'fit',
store :Ext.create('Ext.data.Store', {
model: 'CWFSE.model.Task',// use a model
data: rec.get('tasks'), // set the store data as the tasks array
}),