Hey; I am quite frustrated at this point so hoping someone might be able to shed some light on it. I am making a getStore() call on a defined (Tree)Store, with the intention of pushing it into a nestedlist; the syntax of my Store / Model is the same as the rest of the app, and yet when I try and call setData() on the nestedlist, I can get the following error from debug:
Uncaught Error: [ERROR][Ext.data.Store#setModel] A store needs to have a model defined on either itself or on its proxy
Anyone got any idea what could be the problem here, as I'm at my wits end
Store
Code:
Ext.define('myApp.store.MyEvents', {
extend: 'Ext.data.TreeStore',
requires: 'myApp.model.ListItem',
config: {
model: 'myApp.model.ListItem',
proxy: {
type: 'ajax',
extraParams: {},
url: window.serverPath + '/javascripts/mobile/app/store/test.json',
reader: {
type : 'json',
root: 'items'
}
}
},
});
Model
Code:
Ext.define("myApp.model.ListItem", {
extend: "Ext.data.Model",
fields: [
{ name: 'text', type: 'string' },
{ name: 'date', type: 'string' },
{ name: 'id', type: 'string' }
]
});
Snippet of Controller & View:
Code:
var store = Ext.getStore('MyEvents');
var mytest = this.getMytest();
[...]
store.load({
callback: function(result){
app.unmask();
console.log(store.data.items);
mytest.setData(store.data.items);
[...]
Code:
{
xtype: 'nestedlist',
id: 'mytest',
getItemTextTpl : function(node) {
return template = '<div id="event_{id}_xxxx" class="list-item"><p class="date">{date}</p>{text}</div>';
// Overwrite list item to show custom HTML
},
},