I am trying to load data into a list based on dynamically added parameters. In the console I can see that the data is being fetched, but looking at the store when everyting as rendered, nothing is put in the store, and (of course) nothing is put on the list.
The data are being loaded via the activate event on the view, the view is in a carousel.
I am Sencha Touch 2.0 beta 1
Store
Code:
Ext.define('MyApp.store.Participants', {
extend: 'Ext.data.Store',
config: {
model: 'MyApp.model.Participant',
proxy: {
type: 'ajax',
url: 'xhr/xhrStore.asp?cmd=getParticipants',
reader: {
type: 'json',
rootProperty: 'items'
}
}
}
});
Model:
Code:
Ext.define('MyApp.model.Participant', {
extend: 'Ext.data.Model',
config: {
fields: [
{ name: 'ID', type: 'int', hidden: true },
{ title: 'Billede', name: 'pic', type: 'string' },
{ title: 'Fornavn', name: 'firstname', type: 'string' },
{ title: 'Efternavn', name: 'lastname', type: 'string' }
]
}
});
Method loading the data:
Code:
onLoadParticipantsRequest: function (self, newActiveItem, oldActiveItem, eOpts) {
var index = index = window.location.hash.substring(1).split('/'),
participantsView = this.getParticipantsView(),
store = participantsView.getStore();
store.load({
callback: this.onParticipantsLoaded,
params: {
sel: index[0],
afd: index[1],
afsnit: index[2],
tdate: index[3]
}
});
},
The view with the list:
Code:
Ext.define('MyApp.view.partial.Participants', {
extend: 'Ext.dataview.List',
xtype: 'participants',
config: {
flex: 25,
clearSelectionOnDeactivate: true,
cls: 'participantslist',
id: 'participantslist',
styleHtmlContent: true,
store: 'Participants',
flex: 25,
itemSelector: 'div.participantitem',
itemTpl: ['<div class="participantitem">',
'<img src="{pic}" alt="" />',
'<span class="field">{firstname} {lastname}</span>',
'</div>'].join(''),
items: [{
xtype: 'toolbar',
docked: 'bottom',
items: [{
text: 'Tilføj',
xtype: 'button',
id: 'add_participant_button'
}]
}]
}
});
The data I see loaded but not put in the store afterwards:
Code:
{
"rows": [
{"ID": 1686,"pic": "\u002Fcommon\u002Fimages\u002Ffemale.gif","firstname": "asd","lastname": "asd"},
{"ID": 1913,"pic": "\u002Fcommon\u002Fimages\u002Fmale.gif","firstname": "asd","lastname": "asd"},
{"ID": 2307,"pic": "\u002Fcommon\u002Fimages\u002Ffemale.gif","firstname": "asd","lastname": "asd"},
{"ID": 2214,"pic": "\u002Fcommon\u002Fimages\u002Ffemale.gif","firstname": "asd","lastname": " asd"},
{"ID": 1684,"pic": "\u002Ffiles\u002Fassets\u002Fplus-bolig.dk\asd.gif","firstname": "asd","lastname": "asd"},
{"ID": 2236,"pic": "\u002Fcommon\u002Fimages\u002Ffemale.gif","firstname": "asd ","lastname": "asd"},
{"ID": 1740,"pic": "\u002Fcommon\u002Fimages\u002Fmale.gif","firstname": "asd","lastname": "asd"},
{"ID": 1703,"pic": "\u002Fcommon\u002Fimages\u002Ffemale.gif","firstname": "asd","lastname": "asd"},
{"ID": 1704,"pic": "\u002Fcommon\u002Fimages\u002Fmale.gif","firstname": "asd","lastname": "asd"},
{"ID": 2275,"pic": "\u002Ffiles\u002Fassets\u002Fplus-bolig.dk\asd%C3%asd.jpg","firstname": "asd","lastname": "asd"},
{"ID": 2274,"pic": "\u002Ffiles\u002Fassets\u002Fplus-bolig.dk\asd%20p.jpg","firstname": "asd","lastname": "asd"}
]
}