Column tree

TreeGrid documentation

Since 7.0 version TreeGrid supports tree also in columns, it means hiding and showing individual columns on click to expand / collapse button in some cell (usually header cell).
Similarly it supports also showing and hiding individual rows (usually, but not required, fixed rows) on click to Expand button.
The collapsed / expanded columns or rows do not need to be adjacent!
The tree level count is not limited!
<C> bool

Visible

[1] Saved to cookies, avoid it by <C VisibleLap='1'/>
If the column is displayed in grid. Set <C Visible='0' Hidden='1'/> for collapsed columns on start.
new 6.0 <C> bool

Hidden

[0]
Hidden='1' can be set only for Visible='0' and <Cfg FastColumns ='1'/>. This column will be rendered as hidden (width 0px).
It slows down rendering grid (the column is rendered) but speeds up showing / expanding the column (it is just resized).
Set <C Visible='0' Hidden='1'/> for collapsed columns on start.
new 6.0 upd 15.0 <Cfg> int

FastColumns

[1]
If column hiding is done by setting its width to 0px. This action is faster than removing the cells and speeds up also showing the column.
For expanding / collapsing columns is strongly recommended to use default setting FastColumns='1'.
Since 15.0 it can be set to 2 for xlsx import to not render hidden columns on start except they are in tree.
<I> bool

Visible

[1] Saved to cookies, avoid it by <Cfg ExpandedLap='1'/>
If the row is displayed in grid. Set to 0 for collapsed rows on start.
new 7.0 <C> <cell> string

Button

Button = "Expand"
To show right side Expand button set Button="Expand".
It is shown usually in <Header> cell to show / hide columns, but can be shown in any cell, in variable, fixed or space cell.
new 7.0 <C> <cell> string

Icon

Icon = "Expand"
To show left side Expand button set Icon="Expand".
It is shown usually in <Header> cell to show / hide columns, but can be shown in any cell, in variable, fixed or space cell.
new 15.0 <C> <cell> string

ExpandCol

Name of main column that collapses / expands the cells. Useful for reversed tree with spanned cells.
For example <I Spanned='1' ASpan='3' AButton='Expand' AExpandCol='C' CExpandCells='A,B'/>.
new 7.0 <C> <cell> string[ ]

ExpandCols

A list of column names to show / hide them on click to Button='Expand'.
If you want to have deep tree of expanding columns (more nested levels) you must list here only immediate children, not the whole tree. And set appropriate ExpandLevel to the columns.
new 7.0 upd 9.3 <C> <cell> string[ ]

ExpandRows

A list of row ids to show / hide them on click to Button='Expand'
Since 9.3 the item can be also a Name of default row to represent all rows with this default.
new 7.0 <C> <cell> bool

Expanded

[ ] Saved to cookies, avoid it by <Cfg ExpandedLap='1'/>
Initial state of the Button='Expand'.
If not set, the state is 1 if any column in the ExpandCols is visible. If ExpandCols is not defined it tests ExpandRows.
If neither ExpandCols nor ExpandRows defined returns state of row Expanded attribute.
Set it for more complex tree where the Expanded state is computed incorrectly.
new 7.0 <C> <I> int

ExpandLevel

[ ] Saved to cookies, avoid it by <C VisibleLap='1'/> or <Cfg ExpandedLap='1'/> for rows
The row / column is shown on click to Expand Button when its ExpandLevel is positive (>=1). It is hidden if its ExpandLevel is zero or negative (<=0).
Use it when more Expand Buttons show / hide one row / column.
If not set, every Expand Button shows / hides the row / column on its click.
If set, click to Expand Button will increase (when expanding) / decrease (when collapsing) this value and only if the value changes from 0 to 1 (shows the column / row) or from 1 to 0 (hides the column / row).
The ExpandLevel must be set accordingly to the row / column Visible attribute and also Expanded state of the Expand Buttons that control the row.
Let's say there are three collapsed buttons that control the row. Setting ExpandLevel='-2' means that all three buttons must be expanded to show the row. Setting ExpandLevel='0' means that every button shows the row and all three buttons must be collapsed to hide it. The row attribute Visible must be set to '0'.
Let's say there are three expanded buttons that control the row. Setting ExpandLevel='1' means that all three buttons must be expanded to show the row. Setting ExpandLevel='3' means that every button shows the row and all three buttons must be collapsed to hide it. The row attribute Visible must be set to '1'.
new 9.2 <I> bool

CollapseOther

[0]
If set to 1, it collapses all other cells in this row when some cells is being expanded.
new 9.0 <C> <cell> bool

HideParentCol

[0]
If set to 1, it hides parent column when expanding it = shows the children instead of the parent column and vice versa.
In this case the cell with expand button should be spanned through the child columns to be still visible after the parent column hides.
If used more column levels, they should have set ExpandLevel to correctly hide / collapse the columns.
new 15.0 <C> <I> <cell> bool

ExpandIcon

[0]
Icon type used for Button / Icon = "Expand", bit array.
1. bit &1 - 0 normal direction, 1 - reversed direction (of tree or column tree). Has sense only if the icon has direction, not for + / - icons.
2. bit &2 - 0 without tree lines, 2 - with tree lines. Tree lines implemented only for column tree in responsive css styles.
3. bit &4 - 0 row tree, used to expand rows, 4 - column tree, used to expand columns. Has sense only if the icon has direction, not for + / - icons.
new 9.2 <cell> bool

ShowHiddenBorder

[1]
Set to 1 in the spanned expand / collapse cell when set HideParentCol=1 and FastColumns=1 to not hide the cell border when the column is hidden.
new 7.0 API method bool

IsCellExpanded

(TRow row, string col)
Returns true if the cell side Button Expand is expanded.
new 7.0 API method void

ExpandCell

(TRow row, string col)
Expands or collapses the rows / columns defined by ExpandCols / ExpandRows in the cell.
new 7.0 <Actions>

ExpandCell ...FAO

Assigned to event OnClickSideExpand
Expands or collapses the rows / columns defined by ExpandCols / ExpandRows in actual or focused cell.
new 12.0 <Actions>

ExpandCol ...FAO

Not assigned to any event
Expands columns defined by ExpandCols in actual or focused cell.
new 12.0 <Actions>

CollapseCol ...FAO

Not assigned to any event
Collapses columns defined by ExpandCols in actual or focused cell.
new 12.0 <Actions>

ExpandRow ...FAO

Not assigned to any event
Expands rows defined by ExpandRows in actual or focused cell.
new 12.0 <Actions>

CollapseRow ...FAO

Not assigned to any event
Collapses rowss defined by ExpandRows in actual or focused cell.
new 7.0 <Actions>

ExpandAllCells

not assigned to any event
Expands all cells in all Header rows in grid.
To expand cells in other rows use API IsCellExpanded / ExpandCell in loop instead.
new 7.0 <Actions>

CollapseAllCells

not assigned to any event
Collapsed all cells in all Header rows in grid.
To collapse cells in other rows use API IsCellExpanded / ExpandCell in loop instead.
new 9.2 <Actions>

ExpandRowCells

not assigned to any event
Expands all cells in actual Header row.
new 9.2 <Actions>

CollapseRowCells

not assigned to any event
Collapsed all cells in actual Header row.
new 15.0 API method bool

ShowColTreeLevel

(TRow row)
Collapses all cells in the row and in next fixed rows. And expands all cells in all fixed rows above the row.
Returns true if some change was done.

new 15.0 <Actions>

ShowColTreeLevel ...FA

Attached to event OnClickSideLevel
Expands / collapses grid after click to Level button.

Auto column tree

Creating and maintaining column tree automatically according to the column level.

The column tree is placed above the first header by default, to place it somewhere else, add <I Def='ColTree'/> to the position in <Head> or <Foot> section.
new 15.0 <Cfg> int

ColTree

[0] Saved to cookies, avoid it by <Cfg ColTreeLap='1'/>
If the auto column tree is shown and if it is reversed.
0 - disabled and cannot be shown or changed. It is not saved and exported.
1 - disabled and can be shown. It is not saved and exported.
2 - hidden. It is saved and exported. It is exported as hidden in xlsx.
3 - shown. Parents (summaries) are shown on left side like in normal tree.
4 - shown. Parents (summaries) are shown on right side like in default MS Excel tree.
new 15.0 API method void

SetColTree

(int value)
Changes ColTree to given value and updates the view.
new 15.0 <Cfg> int

ColTreeLast

[1]
If the auto column tree shows last empty row to display Levels button.
new 15.0 <Cfg> int

MaxColLevel

[10]
Maximal level in column tree.
Should be set to reasonable count, to avoid too high head section that displays one row per column tree level.
new 15.0 <C> int

Level

Column level in automatic column tree. 0 means root level.
The Level is automatically updated after indenting or outdenting column.
The Level is automatically decreased if it is higher than previous column Level by 2 or more.
If the next columns have higher level than this column, they are shown as child columns.
If the next child columns are all hidden, this column is marked as collapsed.
new 15.0 <Actions>

IndentCols ...FSARCO

Not attached to any event
Indents actual, focused or selected columns. It increases column Level by 1. It fails if the column level cannot be increased without affecting other columns.
new 15.0 <Actions>

IndentColsForce ...FSARCO

Not attached to any event
Indents actual, focused or selected columns. It increases column Level by 1. It indents also adjacent columns if required.
new 15.0 <Actions>

OutdentCols ...FSARCO

Not attached to any event
Outdents actual, focused or selected columns. It decreases column Level by 1. It fails if the column level cannot be decreased without affecting other columns.
new 15.0 <Actions>

OutdentColsForce ...FSARCO

Not attached to any event
Outdents actual, focused or selected columns. It decreases column Level by 1. It outdents also adjacent columns if required.