ext tree节点要排序该怎么办?
我实现树的代码:
Ext.BLANK_IMAGE_URL
Ext.BLANK_IMAGE_URL='public/ext-2.0.2/s2.gif';
var tree;
var Tree = Ext.tree;
var xt = Ext.tree;
var n;
var tree;
var TreeTest = function(){
// shorthand
return {
init : function(){
var hidfzid = document.getElementById("hidfzid").value;
tree = new Tree.TreePanel({
el:'classes',
animate:true,
autoScroll:true,
loader: new Tree.TreeLoader({dataUrl:'reportfzxxAction.do?method=geturl&fzid='+hidfzid}),
enableDD:true,
containerScroll: true,
dropConfig: {appendOnly:true}
});
new Tree.TreeSorter(tree, {folderSort:true});
var root = new Tree.AsyncTreeNode({
text: '分组分类',
draggable:false, // disable root node dragging
id:'source'
});
tree.setRootNode(root);
tree.render();
root.expand();
tree.on('click', function(node){
//根据fbid得到项目数据 添加到中间的表格中
document.getElementById("hidfzxxid").value=node.id;
document.getElementById("hidccjb").value=node.attributes.ccjb;
parent.query.list.location.href="reportfzxxAction.do?method=getflbyid&id="+node.id+"&fzid="+node.attributes.fzid+"&ccjb="+node.attributes.ccjb;//层次级别
});
}
};
}();
现在的问题是:不管我的数据是[{'text' : '辅助生产成本','id' : '8afc92b6197fecf70119837022bb0005'},{'text' : '基本生产成本','id' : '8afc92b6197fecf70119839285480008'}]还是
[{'text' : '基本生产成本','id' : '8afc92b6197fecf70119837022bb0005'},{'text' : '辅助生产成本','id' : '8afc92b6197fecf70119839285480008'}]
在页面显示时总是基本生产现在在前面! 谁可以解决这个问题啊? 1 楼 seahigh 2008-04-25 new Ext.tree.TreeSorter(tree, {folderSort:true,property:'displayOrder'}); 2 楼 ysm1850 2008-04-25 谢谢这个兄弟!原来我的tree里早就加了TreeSorter这个东西,怪不得老是会排序!