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

Abhijit Muke picture Abhijit Muke · Apr 29, 2015 · Viewed 7.1k times · Source

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

Answer

Ronak Patel picture Ronak Patel · May 3, 2017

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