日期:2014-05-16  浏览次数:20417 次

Extjs 角角落落整理(三)tree的使用
一:延时加载
定义一个BottomTree
Ext.define('LP.view.tree.BottomTree', {
			extend : 'Ext.tree.Panel',
			alias : 'widget.BottomTree',
			dock : 'bottom',
			id:"BottomTree",
			rootVisible : false,
			store : 'LP.store.tree.BottomTreeStore',
			initComponent : function() {
				var me = this;
				Ext.applyIf(me, {
							viewConfig : {

				}			
						});

				me.callParent(arguments);
			}

});

“rootVisible : false,”-----根节点不可见
store : 'LP.store.tree.BottomTreeStore',----store
定义tree的store
Ext.define('LP.store.tree.BottomTreeStore', {
			extend : 'Ext.data.TreeStore',
			proxy : {
				type : 'ajax',
				url : 'treelayou!initTree.action?random='
						+ new Date().getTime()
			},
			root : {
				id : '-2',
				expanded : true
			},
			fields : [{
						name : 'text',
						type : 'string'
					}, {
						name : 'count',
						type : 'int'
					}, {
						name : 'id',
						type : 'string'
					}, {
						name : 'leaf',
						type : 'boolean'
					}, {
						name : 'patentId',
						type : 'string'
					}

			],
			folderSort : true,
			sorters : [{
						property : 'id',
						direction : 'desc'
					}], 
		});

其中“folderSort : true,”便是设置延时加载的