Hi,
for the following code i get this error:
Uncaught TypeError: Object [object Object] has no method 'getAnimation'
So what's wrong? I am using ST2, PR2.
View
PHP Code:
Ext.define('app.view.AlbumNestedList', {
extend: 'Ext.NestedList',
config : {
layout:'fit',
fullscreen: true,
displayField: 'text',
store: null,
title: 'Yea'
}
});
Controller
PHP Code:
Ext.define('app.controller.AlbumTree', {
extend: 'Ext.app.Controller',
requires: ['app.store.Albums'],
stores: ['Albums'],
views: [
'AlbumNestedList'
],
init: function() {
this.view = this.getAlbumNestedListView().create();
this.albumsStore = this.getAlbumsStore();
this.albumsStore.load({
callback: this.onAlbumsLoad,
scope: this
});
this.callParent(arguments);
},
onAlbumsLoad: function() {
this.view.setStore(this.albumsStore);
}
});
Store:
PHP Code:
Ext.define('app.store.Albums', {
extend: 'Ext.data.TreeStore',
requires: 'app.model.Album',
model: 'app.model.Album',
autoLoad: false,
root: {},
proxy: {
type: 'ajax',
url: 'data/albums.json',
reader: {
type: 'json',
root: 'items',
defaultRootProperty: 'items'
}
}
});
Models:
PHP Code:
Ext.define('app.model.Album', {
extend: 'Ext.data.Model',
fields: ['id', 'name' ],
hasMany: [
{model: 'Image', name: 'images'}
]
});
Ext.define('app.model.Image', {
extend: 'Ext.data.Model',
fields: ['id', 'name' ],
belongsTo: 'Album'
});