23457

Customize the Loader for a MVC App

Question:

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

<strong>Edit</strong>

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

<strong>Edit 2</strong>

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?

Answer1:

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.

Answer2:

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.

Recommend

  • Why doesn't my checkbox map to an MVC model member?
  • Symfony2 - Composer class loader instance in controller
  • Spring Security: @PreAuthorize works only together with @RequestMapping
  • When HTTP-POST has body, url parameter is null
  • iOS Localization Doesn't Work with More Than 63 Files
  • why calling cd shell command through system() or execvp() from a child process won't work?
  • Parse a date string in a specific locale (not timezone!)
  • How to get Eclipse Oxygen to run on Java 9
  • Sencha Touch 2.0 Controller refs attribute not working?
  • Chrome doesn't support silverlight anymore? How to solve this?
  • Syntax for setting draggablecursor property in google maps api
  • Paperclip, set path outside of rails root folder
  • PHPUnit_Framework_TestCase class is not available. Fix… - Makegood , Eclipse
  • How do I change content of ComboFieldEditor?
  • QLineEdit password safety
  • req.body is undefined - nodejs
  • Why HTML5 Canvas with a larger size stretch a drawn line?
  • Counter field in MS Access, how to generate?
  • Spray.io: When (not) to use non-blocking route handling?
  • How to redirect a user to a different server and include HTTP basic authentication credentials?
  • Modifying destination and filename of gulp-svg-sprite
  • Javascript + PHP Encryption with pidCrypt
  • Symfony2: How to get request parameter
  • Importing jscolor library in angular 2
  • Weird JavaScript statement, what does it mean?
  • Websockets service method fails during R startup
  • Do I've to free mysql result after storing it?
  • Why winpcap requires both .lib and .dll to run?
  • GridView Sorting works once only
  • R: gsub and capture
  • jqPlot EnhancedLegendRenderer plugin does not toggle series for Pie charts
  • bootstrap to use multiple ng-app
  • SQL merge duplicate rows and join values that are different
  • log4net write single file for each call to log.info
  • Benchmarking RAM performance - UWP and C#
  • Why can't I rebase on to an ancestor of source changesets if on a different branch?
  • Getting error when using KSoap library to consume .NET web services
  • Binding checkboxes to object values in AngularJs
  • Net Present Value in Excel for Grouped Recurring CF
  • How to load view controller without button in storyboard?