自定义MVC应用程序的Loader [英] Customize the Loader for a MVC App

查看:197
本文介绍了自定义MVC应用程序的Loader的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要在我的MVC项目中使用Ext.Loader的自定义路径。我已经看过API,发现没有用。如果我直接设置加载器,那么它就像MVC应用程序设置一样被覆盖。那么如何自定义MVC应用程序的加载程序路径?



另外:如果加载程序可以调整为总结相同的多个需求,这将是非常棒的来源于一个请求。有可能吗?



提前感谢任何建议



修改 / p>

默认情况下,加载程序调用类似于 app / controller / MyController.js app / store / MyStore.js



我的目标是修改这个路径,如 load / data / app / controller / MyController 或更好的加载/数据?ident = app.controller.MyController 或通过JSON获得最佳请求



编辑2



感谢所有回复!我再次看到Ext.app.Application的源代码,但是我找不到加载器初始化的位置。是的,我发现appFolder属性,但不是在哪里使用。而我的AppFolder方法的问题是,由于应用的GET参数,我不能使用路由。所以猜测最好是修改Ext.Loader,不是吗?或者是装载器能够加载整个命名空间吗?

解决方案

如果需要,您可以在应用程序中设置'appFolder'相对于网站更改根。



例如,如果您有www.mysite.com但您想要将.js文件存储在www.mysite.com中/ scripts / ext /你可以这样做:

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

不知道这是否在这里被问及,但可能会给你一个起点。 >

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?

解决方案

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.

这篇关于自定义MVC应用程序的Loader的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆