未启用Ext.loader是否需要缺少? [英] Ext.loader not enabled Missing required?
本文介绍了未启用Ext.loader是否需要缺少?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
Extjs4 librairie存在一些问题. 我想使用treeEditor组件.
I have some problems with Extjs4 librairie. I want to use treeEditor component.
Firebug错误:
Firebug error :
错误:未捕获的异常: 未启用Ext.Loader,因此 依赖关系无法解决 动态地.缺少必填的课程: Ext.tree.TreeNode
Error : uncaught exception: Ext.Loader is not enabled, so dependencies cannot be resolved dynamically. Missing required class: Ext.tree.TreeNode
我的代码:
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.Loader:
The error is due to not enabling the Loader. You can enable the Ext.Loader by:
Ext.Loader.setConfig({enabled:true});
您需要在onReady
方法的开头调用它.
You need to call this at the start of onReady
method.
这篇关于未启用Ext.loader是否需要缺少?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文