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

1

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
       ....
});
Spagyric answered 29/4, 2015 at 7:25 Comment(11)
Did you do a sencha app refresh or sencha app build ?Farnham
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.Farnham
@Seram...after going for sencha app refresh command I ran into dependency error...[ERR] Failed to resolve dependency Gnt.model.Task for file MyTaskModelSpagyric
You'll have to add the location of that file in the sencha classpath - probably that is not set.Farnham
Can you describe how you actually load the extjs files? How your application works..Farnham
@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.RequestSpagyric
My application load css and js files from home.jsp. All css file get loaded from home.jsp only and js too..<script type="text/javascript" src="../UI-INF/ext/build/ext-all-debug.js"></script> <script type="text/javascript" src="../UI-INF/bryntum/gnt-all-debug.js"></script> <script type="text/javascript" src="../UI-INF/app.js"></script>Spagyric
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 locationsFarnham
Please take a look at this - 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 buildFarnham
@Seram can you please join discussion here...chat.stackoverflow.com/rooms/76525/…Spagyric
Were you able to resolve this issue? I am also stick in same situation.Lusatian
J
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
       ....
});
Jenn answered 3/5, 2017 at 13:2 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.