首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 媒体动画 > flex >

tree的xml数据格式,该如何处理

2012-02-25 
tree的xml数据格式我现在生成一个tree,xml格式是,下面这样的是可以把树显示出来XML codexmlnode name

tree的xml数据格式
我现在生成一个tree,xml格式是,下面这样的是可以把树显示出来

XML code
  <xml>    <node name='根节点'>       <node name='节点1' />       <node name='节点2'>    </node>  <xml>

但我现在想在节点上配置一些信息,记录在节点,例如人员,而且是多个人员,如节点1:
XML code
  <xml>    <node name='根节点'>       <node name='节点1'>          <employees>            <employee name='张三' />            <employee name='李四' />          </employees>       </node>       <node name='节点2'>    </node>  <xml>

如果我按上面的xml格式,我的树也把<employees>下面的用户也显示出来,如何让我的树只显示xml中位node的数据,就是下列样式:
  根节点
  |____节点1
  |____节点2

[解决办法]
定义个类继承DefaultDataDescriptor,重写方法getChildren
比如:
XML code
override public function getChildren(node:Object, model:Object=null):ICollectionView{            var result:ICollectionView = super.getChildren(node, model);                        var children:ListCollectionView;                        if(result is ListCollectionView){                children = new ArrayCollection();                children.list = (result as ListCollectionView).list;                }else{                children = new ArrayCollection([]);                var cursor:IViewCursor = result.createCursor();                while(cursor.current){                    children.addItem(cursor.current);                    cursor.moveNext();                }            }            children.filterFunction = this.filterFunction;            children.refresh();            return children;        } 

热点排行