当前位置:首页 > 开发 > Web前端 > 前端 > 正文

flexlib的treeGrid用法

发表于: 2012-11-30   作者:darrenzhu   来源:转载   浏览次数:
摘要: 为了使用treeGrid,通常你需要定义自己的DataDescriptor和data model,下面是一个案例. public class HierarchySearchResultVO { public function HierarchySearchResultVO(){ this._id=UIDGenerator.createUID(); }
为了使用treeGrid,通常你需要定义自己的DataDescriptor和data model,下面是一个案例.

	public class HierarchySearchResultVO
	{
		public function HierarchySearchResultVO(){
				this._id=UIDGenerator.createUID();
		}
		
		/**
		 * An unique identifier of the created HierarchySearchResultVO object.
		 */ 
		[Transient]
		private var _id:String;
		
		public function get id():String{
			return this._id;
		}
		
		public function set id(value:String):void{
			this._id=value;
		}
		
		/**
		 * If not a summary record, it should have a parent.
		 */ 
		[Transient]
		public var parent:HierarchySearchResultVO;
		
		/**
		 * Indicates whether the record shows at summary level or detail level in a treeGrid.</br>
		 * True denotes a summary record, false denotes detail record, default is false.
		 */ 
		[Transient]
		public var isSummaryRecord:Boolean=false;
		
		/**
		 * Only applicable to summary record.
		 * Indicates whether the summary record has got its children from server.</br>
		 * True denotes the summary record has already got its children from serve;</br>
		 * False denotes not yet.
		 */ 
		[Transient]
		public var hasChildrenReturned:Boolean=false;
		
		/**
		 * Indicates whether the summary record itself or detail record is checked,
		 * isAllSeleceted and isPartSelected are used to indicate whether the children of 
		 * the summary record are checked, they don't indicate the check status of the summary record itself.
		 */ 
		[Transient]
		public var isSelected:Boolean=false;
		
		/**
		 * Indicates whether all the children records of a summary record have been checked,
		 * only used for a summary record, should be exclusive with isPartSelected. 
		 * If isAllSelected=false and isPartSelected=false means none of the children records have been checked.
		 */ 
		//[Transient]
		//public var isAllSelected:Boolean=false;
		
		/**
		 * Indicates only part of the children records of a summary record have been checked,
		 * only used for a summary record, should be exclusive with isAllSelected. 
		 * If isAllSelected=false and isPartSelected=false means none of the children records have been checked.
		 */
		[Transient]
		public var isPartSelected:Boolean=false;
		
		/**
		 * This property name should be same as what we defined in HierarchySearchResultDataDescriptor,
		 * element should be object of HierarchySearchResultVO, not SearchResultVO.
		 */ 
		[Transient]
		public var childrenCollection:ArrayCollection;
		
		public var searchResultVO:SearchResultVO;
}



	/**
	 * Used to parse the data of the TreeGrid
	 */ 
	public class HierarchySearchResultDataDescriptor extends DefaultDataDescriptor
	{
		public function HierarchySearchResultDataDescriptor()
		{
			super();
		}
		
		override public function getChildren(node:Object, model:Object=null):ICollectionView
		{
			return node.childrenCollection;
		}
		
		override public function hasChildren(node:Object, model:Object=null):Boolean
		{
			return node != null && node.childrenCollection != null && (node.childrenCollection as ArrayCollection) != null && (node.childrenCollection as ArrayCollection).length > 0;
		}
		
		override public function isBranch(node:Object, model:Object=null):Boolean
		{
			return (node as HierarchySearchResultVO).isSummaryRecord;
		}
		
		override public function getData(node:Object, model:Object=null):Object
		{
			return node;
		}
		
	}

flexlib的treeGrid用法

  • 0

    开心

    开心

  • 0

    板砖

    板砖

  • 0

    感动

    感动

  • 0

    有用

    有用

  • 0

    疑问

    疑问

  • 0

    难过

    难过

  • 0

    无聊

    无聊

  • 0

    震惊

    震惊

编辑推荐
参考官方地址:http://www.jeasyui.com/demo/main/index.php?plugin=TreeGrid&theme=default&dir=lt
一、TreeGrid组件相关的类 1、TreeGrid(_config) _config:json格式的数据,组件所需要的数据都通过
看到 extjs 的 TabNavigator和漂亮. 很实用. 对于一个后台管理程序来说 可以同时操作多个 任务. 如
看到 extjs 的 TabNavigator和漂亮. 很实用. 对于一个后台管理程序来说 可以同时操作多个 任务. 如
最近在使用EasyUI,第一个使用了treegrid,easyui treegrid使用时需注意:  1、必须要有根节点; 2
礼物一:树型实体的抽象与封装   所谓树型实体,就是具有树型结构关系的实体,比如省、市、区。对
treegrid可以帮助我们事件树状下钻的报表格式,如图: 代码主要结构: $('#tt').treegrid({ url:'tr
最近在做一个ext的项目,刚开时学ext,做一个树形显示列表,要求异步加载,在网上找了好久都没找到
导入easyUi的工具包 在jsp页面引入 <head> <meta http-equiv="content-type" content="tex
Jquery EasyUI中treegrid的中右键菜单和一般按钮同时绑定事件时的怪异事件 InChatter系统开源聊天模
版权所有 IT知识库 CopyRight © 2009-2015 IT知识库 IT610.com , All Rights Reserved. 京ICP备09083238号