Extjs4 Ext.loader未启用缺少必需的文件?

Extjs4 Ext.loader未启用缺少必需的文件?,extjs4,Extjs4,我对Extjs4库有一些问题。 我想使用treeEditor组件 Firebug错误: 错误:未捕获异常: Ext.Loader未启用,因此 无法解析依赖项 动态地。缺少必需的类: 外树 我的代码: Ext.require([ 'Ext.form.*', 'Ext.grid.*', 'Ext.tree.*', 'Ext.data.*', 'Ext.util.*', 'Ext.loader.*', 'Ext.state.*', 'Ext.layout.container.Column', 'Ex

我对Extjs4库有一些问题。 我想使用treeEditor组件

Firebug错误:

错误:未捕获异常: Ext.Loader未启用,因此 无法解析依赖项 动态地。缺少必需的类: 外树

我的代码:

Ext.require([

'Ext.form.*',
'Ext.grid.*',
'Ext.tree.*',
'Ext.data.*',
'Ext.util.*',
'Ext.loader.*',
'Ext.state.*',
'Ext.layout.container.Column',
'Ext.tab.TabPanel'

]);

Ext.onReady(function(){

    // shorthand
    Ext.QuickTips.init();


    var tree = Ext.create('Ext.tree.TreePanel', {
            animate:false,
            enableDD:false,
    //      loader: new Tree.TreeLoader(), // Note: no dataurl, register a TreeLoader to make use of createNode()
            lines: true,
            rootVisible:false,
        //  selModel: new Ext.tree.MultiSelectionModel(),
            containerScroll: false
    });

        // set the root node
        var root = Ext.create('Ext.tree.TreeNode',{
            text: 'Autos',
            draggable:false,
            id:'source'
        });

        tree.on('contextmenu',showCtx);
        tree.on('click',function(node,e){node.select();return false;});
        // json data describing the tree

        var json = [
                {"text" : "1","allowEdit" : true, "id" : 300, "leaf" : false, "cls" : "folder", "children" : [
                {"text" : "11","allowEdit" : true, "id" : 3000, "leaf" : false, "cls" : "folder","children" :[
                {"text" : "111","allowEdit" : true, "id" : 300, "leaf" : false, "cls" : "folder","children" :[
                {"text" : "1111","allowEdit" : true, "id" : 300, "leaf" : true, "cls" : "file"},
                {"text" : "1112","allowEdit" : true, "id" : 300, "leaf" : true, "cls" : "file"},
                {"text" : "1113","allowEdit" : true, "id" : 300, "leaf" : true, "cls" : "file"}
                ]},
                {"text" : "112","allowEdit" : true, "id" : 300, "leaf" : true, "cls" : "file"},
                {"text" : "113","allowEdit" : true, "id" : 300, "leaf" : true, "cls" : "file"}
                ]},
                {"text" : "12","allowEdit" : true, "id" : 300, "leaf" : true, "cls" : "file"},
                {"text" : "13","allowEdit" : true, "id" : 300, "leaf" : true, "cls" : "file"}
                ]},
                {"text" : "2","allowEdit" : true, "id" : 300, "leaf" : true, "cls" : "file"},
                {"text" : "3","allowEdit" : true, "id" : 300, "leaf" : true, "cls" : "file",iconCls:'node'}
                ];

                for(var i = 0, len = json.length; i < len; i++) {
                root.appendChild(tree.getLoader().createNode(json[i]));
                }

        var ge = Ext.create('Ext.tree.TreeEditor',tree,{},{
            allowBlank:false,
            blankText:'Nom du dossier',
            selectOnFocus:true,
            cancelOnEsc:true,
            completeOnEnter:true,
            ignoreNoChange:true,
            updateEl:true
            });

            /*ge.on('beforestartedit', function(){

            if(!ge.editNode.attributes.allowEdit){
                return false;
            }
                });*/

        tree.setRootNode(root);
        tree.render();
        root.expand(true);

        });
Ext.require([
“Ext.form.*”,
“Ext.grid.*”,
“Ext.tree.*”,
“Ext.data.*”,
“Ext.util.*”,
“Ext.loader.*”,
“Ext.state.*”,
“Ext.layout.container.Column”,
“Ext.tab.TabPanel”
]);
Ext.onReady(函数(){
//速记
Ext.QuickTips.init();
var tree=Ext.create('Ext.tree.TreePanel'{
动画:假,
enableDD:false,
//loader:new Tree.TreeLoader(),//注意:没有dataurl,请注册一个TreeLoader以使用createNode()
台词:对,
rootVisible:false,
//selModel:new Ext.tree.MultiSelectionModel(),
集装箱克罗尔:错
});
//设置根节点
var root=Ext.create('Ext.tree.TreeNode'{
文本:“自动”,
可拖动:错误,
id:‘来源’
});
在('contextmenu',showCtx)上;
on('click',函数(node,e){node.select();返回false;});
//描述树的json数据
var json=[
{“text”:“1”,“allowEdit”:true,“id”:300,“leaf”:false,“cls”:“folder”,“children”:[
{“text”:“11”,“allowEdit”:true,“id”:3000,“leaf”:false,“cls”:“folder”,“children”:[
{“text”:“111”,“allowEdit”:true,“id”:300,“leaf”:false,“cls”:“folder”,“children”:[
{“text”:“1111”,“allowEdit”:true,“id”:300,“leaf”:true,“cls”:“file”},
{“text”:“1112”,“allowEdit”:true,“id”:300,“leaf”:true,“cls”:“file”},
{“text”:“1113”,“allowEdit”:true,“id”:300,“leaf”:true,“cls”:“file”}
]},
{“text”:“112”,“allowEdit”:true,“id”:300,“leaf”:true,“cls”:“file”},
{“text”:“113”,“allowEdit”:true,“id”:300,“leaf”:true,“cls”:“file”}
]},
{“text”:“12”,“allowEdit”:true,“id”:300,“leaf”:true,“cls”:“file”},
{“text”:“13”,“allowEdit”:true,“id”:300,“leaf”:true,“cls”:“file”}
]},
{“text”:“2”,“allowEdit”:true,“id”:300,“leaf”:true,“cls”:“file”},
{“text”:“3”,“allowEdit”:true,“id”:300,“leaf”:true,“cls”:“file”,iconCls:'node'}
];
for(var i=0,len=json.length;i

谢谢:)

此错误是由于未启用加载程序造成的。您可以通过以下方式启用Ext.Loader:

Ext.Loader.setConfig({enabled:true});

您需要在
onReady
方法的开头调用它。

这在ExtJS4中对我很有效。刚刚添加了
Ext.Loader.setConfig({enabled:true})到app.js的顶部。

真正的问题是您使用的是ext-debug.js,ext.js

改用:ext-all.js或ext-dev.js

关于动态加载的阅读

index.html示例:

<html>
  <head>
      <title>Hello Ext</title>
      <link rel="stylesheet" type="text/css" href="ext-4/resources/css/ext-all.css">
      <script type="text/javascript" src="ext-4/ext-dev.js"></script>
      <script type="text/javascript" src="app.js"></script>
  </head>
  <body></body>
</html> 

你好,分机
在本例中,您不需要启用动态加载,因为动态加载是针对开发环境的。ext-all.js,ext.js用于部署。ext-all-debug.js和ext-debug.js用于部署后的调试


MVC和动态加载在部署中是无用的,因为您必须有一个由sencha cmd(也称为sencha工具)生成的文件。

我看了这一点,不得不退一步,因为我是一个ExtJS新手。我不清楚关于将其放置在OnReady呼叫之前的一般性声明的内容

5.0版网站上的以下内容也显示了这个示例,以便更好地理解Ext.Loader类调用的位置。在我看来,使用多个JavaScript标记有点夸张

<script type="text/javascript" src="ext-core-debug.js"></script>
<script type="text/javascript">
    Ext.Loader.setConfig({
      enabled: true,
      paths: {
          'My': 'my_own_path'
      }
    });
</script>
<script type="text/javascript">
    Ext.require(...);

    Ext.onReady(function() {
      // application code here
    });
</script>

如果您的加载程序有问题,那么您可能也想查看Ext.require和Ext.exclude类,以了解它们是如何交互加载自定义类的。

它也不起作用!错误:Erreur:uncaught异常:尝试从路径“/tree/TreeEditor.js”加载类“Ext.tree.TreeEditor”时出错:未定义新错误是因为Ext js源中没有TreeEditor.js文件!我想你必须等待Sencha发布它。哦,好吧!我在sencha doc上看到TreeGrid!非常感谢您的回答:)如果我使用动态组件加载程序,它会降低我的应用程序的性能吗?
Ext.Loader.setConfig({enabled:true});

Ext.application({
    name                : 'MyApp',
    appFolder           : 'app',
    controllers         : [
        'MyApp.controller.item.Item'
    ],
    autoCreateViewport  : true

});