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

I'm migrating ext js 4 to ext js 5.1 .I have code in my extjs 4.2.1 which is giving console error after upgrading to extjs 5.1 .It was working good in ExtJs 4.2.1, don't know why it is giving error, saying

Uncaught 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
       ....
});


Solution 1:[1]

You cannot use Ext.Create while defining class.

You have to use initComponent method in which you can assign config using 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
       ....
});

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Ronak Patel