5
votes

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
       ....
});
1
Did you do a sencha app refresh or sencha app build ? - Yellen
Supposing your classpath is proper and the file is located in the proper directory as per the name - sencha app refresh or sencha app build will first update your bootstrap.json file with all the required classes in your project along with the path to look up that class also the aliases/alternate classname, if any, for the classes. This is required for you bootloader to correctly load the classes. - Yellen
@Seram...after going for sencha app refresh command I ran into dependency error...[ERR] Failed to resolve dependency Gnt.model.Task for file MyTaskModel - Abhijit Muke
You'll have to add the location of that file in the sencha classpath - probably that is not set. - Yellen
Can you describe how you actually load the extjs files? How your application works.. - Yellen

1 Answers

0
votes

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