如何在MVC模式中包含一个UX类? [英] How do you include a UX class in the MVC pattern?
问题描述
Ext.onReady
之前: Ext.Loader.setConfig({enabled:true});
Ext.Loader.setPath('Ext.ux','extjs / examples / ux');
Ext.require([
'Ext.ux.grid.FiltersFeature'
]);
现在我正在使用MVC模式,我有一个需要使用同样功能的网格面板。我在这样的视图中包含了一个require语句:
Ext.define('ST.view.StudentLog',{
extends:'Ext.grid.Panel',
alias:'widget.studentlog',
要求:[
'Ext.ux.grid.FiltersFeature'
],
但是,当应用程序首次开始加载时,会产生404错误。
任何想法?
编辑:
我已经尝试将同样的代码块放在视图的顶端也没有用(参考 Ext.Loader.setConfig / .setPath
块) 。
加载器不断尝试从 extjs / src / ux /
加载UX类,无论我如何尝试告诉它否则根据这个建议,我也试过在我的应用程序控制器中定义一个路径属性,但它似乎是什么回答者在源代码中看到,然后不存在于4.1 rc3中,因为我找不到它,它不起作用。
如果我只是添加FilterFeature。 js作为我的HTML中的导入源文件,使用< script>
标签,所有这些都是依赖关系在我的应用程序启动时获得404错误。
直接从UX文件夹中直接将UX类包含在应用程序中,以便链接到其他UX依赖关系。
确定我从此帖发现
只需使用应用控制台顶部的 Ext.Loader.setPath
调用,例如:
Ext.Loader.setPath('Ext.ux','extjs / examples / ux');
Ext.application({
name:'ST',
autoCreateViewport:true,
...
或者你想要放置ux类的任何地方,为了冷凝目的,应该将应用程序特定的UX类拉出并粘贴到您自己的文件夹中,如 app / ux
作为封面。
Before the MVC pattern I would include UX classes simply by including this at the top of the JS, before Ext.onReady
:
Ext.Loader.setConfig({enabled: true});
Ext.Loader.setPath('Ext.ux', 'extjs/examples/ux');
Ext.require([
'Ext.ux.grid.FiltersFeature'
]);
Now I am working with the MVC pattern and I have a gridpanel that needs to use this same feature. I've included a requires statement in the view like this:
Ext.define('ST.view.StudentLog', {
extend: 'Ext.grid.Panel',
alias: 'widget.studentlog',
requires: [
'Ext.ux.grid.FiltersFeature'
],
But the app produces a 404 error when it first starts loading with this.
Any ideas?
EDIT:
I've tried putting this same block of code at the top of the view also to no avail (referring to the Ext.Loader.setConfig / .setPath
block).
The loader keeps trying to load UX classes from extjs/src/ux/
no matter how I try to tell it otherwise. According to this suggestion, I've also tried defining a path property in my app controller but it seems like whatever the answerer saw in the source back then doesn't exist in 4.1 rc3 because I can't find it and it doesn't work.
If I just add the FilterFeature.js as an imported source file in my HTML with <script>
tags then all of it's dependencies get 404 errors when my app starts.
There must be a simple way of including UX classes in an app straight from the UX folder so that it can link to other UX dependencies.
Ok I found it from this post.
Just need to use Ext.Loader.setPath
call at the top of the app controller, e.g.:
Ext.Loader.setPath('Ext.ux', 'extjs/examples/ux');
Ext.application({
name: 'ST',
autoCreateViewport: true,
...
Or wherever you want to put the ux classes, for condensing purposes, the app specific UX classes should be pulled out and stuck in your own folder something like app/ux
as the post covers.
这篇关于如何在MVC模式中包含一个UX类?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!