Hello,
I have a working List item that uses a model and store. In the model i load a external json file.
It works great.
I found a way to acces this data and use it for another component (the footerbar with buttons on it)
The problem is that when I want to acces the data, it is not loaded yet or not accesable, so for now I
did a very dirty solotion and put a delay on it. But I was wondering if there is an event or a better way to
get the data when it's loaded? Thanks in advance.
This is how it works now:
Inside the conroller:
Code:
launch : function() {
var me = this;
setTimeout(function(){
me.setFooterIconsData();
},100);
}
setFooterIconsData : function() {
var me = this;
var ft = me.getFooterMenu();
var tot = ft.items.items.length;
var localStore = Ext.getStore('Pages');
for(var i = 0; i< tot; i++ ){
var newtitle = localStore.data.items[i].data.iconName;
ft.items.items[i].setTitle(newtitle);
}
},
The Model that I use:
Code:
//The model
Ext.define('Lericrystal.model.Page', {
extend : 'Ext.data.Model',
fields : [
{ name : 'id', type : 'int' },
{ name : 'xtype', type : 'string'},
{ name : 'name', type : 'string' },
{ name : 'iconName', type : 'string' },
{ name : 'image', type : 'string' },
{ name : 'content', type : 'string' }
],
proxy : {
type : 'ajax',
url : 'resources/pages.json',
reader : {
type : 'json',
root : 'pages',
successProperty : 'success',
totalProperty : 'total'
}
}
And the store:
Code:
//The Store
Ext.define('Lericrystal.store.Pages', {
extend : 'Ext.data.Store',
model : 'Lericrystal.model.Page',
autoLoad : true
});