Uncaught Error: [Ext.create] Unrecognized class name / alias: MyApp.store.LibraryFolderTreeStore

I am transferring ext js 4 to ext js 5.1

. I have some code in my extjs 4.2.1 that gives a console error after upgrading to extjs 5.1 . It works fine in ExtJs 4.2.1, I know why it is giving an error saying

Unprepared error: [Ext.create] Unrecognized class name / alias: MyApp.store.LibraryFolderTreeStore

Ext.define('MyApp.view.library.LibraryTreeView', {
       extend : 'Ext.tree.Panel',
       alias : 'widget.librarytreeview',
       requires: [
         'MyApp.store.LibraryFolderTreeStore'
       ],
       store : Ext.create("MyApp.store.LibraryFolderTreeStore") // getting error on this line
       ....
});

      

+3


source to share


1 answer


You cannot use Ext.Create

when defining a class.

You should use a method initComponent

where you can assign the config with Ext.Create

.



Ext.define('MyApp.view.library.LibraryTreeView', {
       extend : 'Ext.tree.Panel',
       alias : 'widget.librarytreeview',
       requires: [
         'MyApp.store.LibraryFolderTreeStore'
       ],
       initComponent : function(){
       this.store = Ext.create("MyApp.store.LibraryFolderTreeStore");
       this.callParent();
       }
        // getting error on this line
       ....
});

      

0


source







All Articles