6

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
       ....
});
Abhijit Muke
  • 1,194
  • 3
  • 16
  • 41
  • 2
    Did you do a *sencha app refresh* or *sencha app build* ? – Yellen Apr 29 '15 at 07:39
  • 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 Apr 29 '15 at 07:43
  • @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 Apr 29 '15 at 09:43
  • You'll have to add the location of that file in the sencha classpath - probably that is not set. – Yellen Apr 29 '15 at 09:47
  • Can you describe how you actually load the extjs files? How your application works.. – Yellen Apr 29 '15 at 09:48
  • @Seram...done with adding classpath for bryntum in app.json and `sencha app refresh` successfully...but still having warnings _[WRN] Encountered multiple matches for name Request : Request, RUI.controller.Request_ – Abhijit Muke Apr 29 '15 at 10:18
  • My application load css and js files from home.jsp. All css file get loaded from home.jsp only and js too..` ` – Abhijit Muke Apr 29 '15 at 10:23
  • That should not break your app. Although, you should get it corrected. I'm not certain but that's probably because you might be having multiple requires for RUI.controller.Request class or there are multiple of that Class in more than one of your classpath locations – Yellen Apr 29 '15 at 10:28
  • Please take a look at this - http://docs.sencha.com/cmd/5.x/microloader.html I'm not saying that it'll not work they way you are loading but this is a better approach. Also, better to use the resources generated by *sencha app build* – Yellen Apr 29 '15 at 12:47
  • @Seram can you please join discussion here...http://chat.stackoverflow.com/rooms/76525/discussion-between-abhijit-muke-and-seram – Abhijit Muke Apr 30 '15 at 05:20
  • Were you able to resolve this issue? I am also stick in same situation. – Jeba Prince Sep 12 '16 at 11:33

1 Answers1

0

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
       ....
});
Ronak Patel
  • 651
  • 6
  • 19