I have many apps in my ExtJS project. I have a model which should be available in every app. So I have to redefine it for each app. Is there any way to use this model for other apps? I tried to add the model by its full namespace. But it didn’t work.
So, Do you have any idea?
Using a project structure like this:
root
- models
- mymodel
MyEntity.js
- myothermodel
MyOtherEntity.js
- app1
index.html
app.js
- app2
index.html
app.js
- app.. N
index.html
app.js
Add
Ext.Loader.setPath("MySharedModels", "../models");at top of your projects app.js, then you can reference your entities consistently:“MyEntity” class can be reached as
MySharedModels.mymodel.MyEntityand“MyOtherEntity” class can be reached as
MySharedModels.myothermodel.MyOtherEntity