Customize the Loader for a MVC App

2019-08-10 20:30发布

I need to use a customize path for the Ext.Loader in my MVC project. I've already looked through the API and found nothing useable. If I set the loader directly it gets simply overriden, as it seems by the MVC app settings. So how can I customize the loader path for a MVC app?

In addition: It would be awesome if the loader could be tweaked to sumarize multiple requirements that occours by the same source into one request. Would that be possible?

Thanks in advance for any suggestions

Edit

The loader by default calling something like app/controller/MyController.js or app/store/MyStore.js

My goal is to modify this path like load/data/app/controller/MyController or better load/data?ident=app.controller.MyController or best request via JSON

Edit 2

Thanks for all reply! I looked again into the sourcecode of the Ext.app.Application but I could not find where the loader get initialized. Yes, I found the appFolder property but not where it is used. And my Problem with the appFolder approach is, that I can't use routes because of the applied GET param. So guess the best is to modify the Ext.Loader, isn't it? Or is the loader capable of loading entire namespaces?

2条回答
做个烂人
2楼-- · 2019-08-10 20:45

You can set the 'appFolder' config property in your application if you need to change the root relative to the website.

For example, if you have www.mysite.com but you want to store you .js files in www.mysite.com/scripts/ext/ you could do something like this:

Ext.application({
    name: 'MySite',
    appFolder: '/scripts/ext'
});

Not sure if that's quite what's being asked here, but might give you a start point.

查看更多
成全新的幸福
3楼-- · 2019-08-10 20:53

I guess what you are trying to archive is not possible without many modifications. You have to change the loader for that so that it fit your request needs. I think you may go better to define some routes in your backend and use the approach @dougajmcdonald wrote. I think you will endup in nearly the same.

But you should note that it is much faster when you let Webserver fetch the files then doing it per code.

查看更多
登录 后发表回答