gridx
Legend: Array Boolean Constructor Date DomNode Error Function Namespace Number Object RegExp Singleton String

gridx.modules.Tree

Object » _Module » gridx.modules.Tree
dojo.require("gridx.modules.Tree");
Defined in gridx/modules/Tree.js

This module is used for creation, destruction and management of the Tree Grid. There are two kind of Tree Grid: columnar or nested, it will be indicated by the argument type, and the layout of the TreeGrid will be defined by extended structure argument.

Examples:

Example 1

For the columnar Tree Grid, the column which is expandable is indicated by the new added attribute `expandField`, and the value of the `expandField` is one or more attribute names (attributes in the meta data) that specify that item's children. See the quick sample below: sample of data source
	{ identifier: 'name',
	  label: 'name',
	  items: [
		{ name:'Africa', type:'continent', children: [
			{ name:'Egypt', type:'country' },
			{ name:'Kenya', type:'country', children:[
				{ name:'Nairobi', type:'city', adults: 70400, popnum: 2940911 },
				{ name:'Mombasa', type:'city', adults: 294091, popnum: 707400 } ]
			},
			{ name:'Sudan', type:'country', children:
				{ name:'Khartoum', type:'city', adults: 480293, popnum: 1200394 }
			} ]
		},
		{ name:'Asia', type:'continent', children:[
			{ name:'China', type:'country' },
			{ name:'India', type:'country' },
			{ name:'Russia', type:'country' },
			{ name:'Mongolia', type:'country' } ]
		},
		{ name:'Australia', type:'continent', population:'21 million', children:
			{ name:'Commonwealth of Australia', type:'country', population:'21 million'}
		} ]
	}
define the grid structure
	var structure = [
		{name: "Name", field: "name", expandLevel: 'all'},
		{name: "Type", field: "type"},
		{name: "Population", field: "population"}
	];
For the nested TreeGrid, there could be more than one column can be expanded, so the structure might be a little more complicated. There is ONLY one attribute name can be assigned to the `expandField` as children, and there would be a attribute called `nestedLevel` to specify the hierarchy of the column. A quick sample: sample of data source
	{ identifier: 'id',
	  items: [
		{ id: "1", playername: "Player 1", seasons: [
			{ id: "2", seasonindex: "Season 1", games: [
				{ id: "3", gameindex: "Game 1", quarters: [
					{id: "4", point: "3", rebound: "3", assistant: "1"},
					{id: "5", point: "5", rebound: "0", assistant: "0"},
					{id: "6", point: "0", rebound: "1", assistant: "3"},
					{id: "7", point: "2", rebound: "2", assistant: "0"} ]
				},
				{ id: "8", gameindex: "Game 2", quarters: [
					{id: "9", point: "3", rebound: "0", assistant: "2"},
					{id: "10", point: "0", rebound: "4", assistant: "1"},
					{id: "11", point: "5", rebound: "0", assistant: "1"},
					{id: "12", point: "10", rebound: "2", assistant: "0"} ]
				} ]
			},
			{ id: "13", seasonindex: "Season 2" } ]
		} ]
	}
define the tree grid type
	treeNested: true;
define the grid structure
	var structure = [
		{name: "Player", field: "playername", expandLevel: 1},
		{name: "Season", field: "seasonindex", expandLevel: 2},
		{name: "Game", field: "gameindex", expandLevel: 3},
		{name: "Point", field: "point"},
		{name: "Rebound", field: "rebound"},
		{name: "Assistant", field: "assistant"}
	];

Property Summary

Method Summary

Event Summary

Attached Objects

Properties

grid
Overrides _Module
rowMixin
Overrides _Module

Methods

_clear
Overrides _Module
_createCellWrapper
Overrides _Module
ParameterTypeDescription
wrappers
rowId
colId
_getAbsoluteVisualIndex
Overrides _Module
ParameterTypeDescription
parentId
rowIndex
_getChild
Overrides _Module
ParameterTypeDescription
visualIndex
info
_initExpandLevel
Overrides _Module
_initFocus
Overrides _Module
_logicCollapse
Overrides _Module
ParameterTypeDescription
id
_logicExpand
Overrides _Module
ParameterTypeDescription
id
_onAfterRow
Overrides _Module
ParameterTypeDescription
row
_onCellClick
Overrides _Module
ParameterTypeDescription
e
_onKey
Overrides _Module
ParameterTypeDescription
e
_updateBody
Overrides _Module
ParameterTypeDescription
id
canExpand
Overrides _Module
Whether the row can be expanded.
Check whether a row can be expanded.
ParameterTypeDescription
idStringThe row ID
collapse
Overrides _Module
Returns dojo.Deferred: A deferred object indicating whether this collapsing process has completed.
Collapse a row.
ParameterTypeDescription
idStringThe row ID
skipUpdateBodyBooleanIf set to true the grid will not automatically refresh itself after this method, so that several grid operations can be executed altogether.
collapseRecursive
Overrides _Module
A deferred object indicating whether this collapsing process has completed.
Recursively collapse a row recursively and all its descendants.
ParameterTypeDescription
idStringThe row ID
skipUpdateBodyBooleanIf set to true the grid will not automatically refresh itself after this method, so that several grid operations can be executed altogether.
constructor
Overrides _Module
expand
Overrides _Module
Returns dojo.Deferred: A deferred object indicating whether this expanding process has completed.
Expand the row.
ParameterTypeDescription
idStringThe row ID
skipUpdateBodyBooleanIf set to true the grid will not automatically refresh itself after this method, so that several grid operations can be executed altogether.
expandRecursive
Overrides _Module
A deferred object indicating whether this expanding process has completed.
Recursively expand a row and all its descendants.
ParameterTypeDescription
idStringThe row ID
skipUpdateBodyBooleanIf set to true the grid will not automatically refresh itself after this method, so that several grid operations can be executed altogether.
getAPIPath
Overrides _Module
getRowInfoByVisualIndex
Overrides _Module
Returns Object: A row info object
Get row info (including row index, row id, parent id, etc) by row visual index.
ParameterTypeDescription
visualIndexInteger
rootStartInteger
getVisualIndexByRowInfo
Overrides _Module
ParameterTypeDescription
parentId
rowIndex
rootStart
getVisualSize
Overrides _Module
ParameterTypeDescription
start
count
parentId
isExpanded
Overrides _Module
Returns Boolean: Whether the row is expanded.
Check whether a row is already expanded.
ParameterTypeDescription
idStringThe row ID
load
Overrides _Module
ParameterTypeDescription
args
preload
Overrides _Module

Events

onCollapse
Overrides _Module
Fired when a row is collapsed.
ParameterTypeDescription
idStringThe ID of the collapsed row.
onExpand
Overrides _Module
Fired when a row is expanded.
ParameterTypeDescription
idStringThe ID of the expanded row