Column visibility

TreeGrid documentation

<C> bool

Visible

[1] Saved to cookies, avoid it by <C VisibleLap='1'/>
If the column is displayed in grid.
Hidden column can be shown by a user from columns menu or by action - depending on CanHide settings.
upd 8.0 <C> int

CanHide

[1]
If the column can be hidden or shown by a user action.
It controls also if the column is displayed in Columns visibility menu.
If set to 0, the column can be shown or hidden by API ShowCol / HideCol only. If the column has Visible='0' and is in Sort, it cannot be removed from the Sort.
If set to 1, the column can be shown or hidden also by actions like ShowCol / HideCol and from Columns visibility menu.
If set to 2, (since 8.0) the column can be shown or hidden by API ShowCol / HideCol only, but its sort behavior is normal. Use for child columns in tree.
You can also use CanHide=0 and Visible=0 to define always hidden column to store any custom data or to predefine sorting behavior - see Sort attribute.
new 6.0 <Cfg> bool

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.
The column is hidden correctly, but it is still present in HTML and is not removed either on re-render.
If the column is shown for first time (it was not displayed on first render, had set <C Visible='0'/>), it is still slow.
new 6.0 <C> bool

Hidden

[0]
Hidden='1' has sense only for Visible='0' and <Cfg FastColumns ='1'/>. On start or re-render this column will be rendered as hidden (width 0px).
It slows down rendering grid (the column is rendered) but speeds up showing column (it is just resized).
Set it to 1 if you expect the column will be shown later to speed it up.
<Space cell> bool

Visible

[1]
Space cells are independent on columns and can be shown or hidden by its cell attribute Visible.
If the space cell is not visible, it is not displayed at all (it is displayed with zero width).
Remember, this attribute can be also calculated (colVisibleFormula), so you can show or hide the space cells dynamically by the formula.
<I cell> int

Visible

[1]
The normal (not Space) cells cannot be hidden completely, they will have always the width of its column.
If set Visible attribute to 0, the cell content is not displayed - the cell is shown empty, but its left / right button is visible.
If set Visible attribute to -1, the cell content is shown empty and also its left / right side button is not displayed.
upd 7.0 API method void

ShowCol

(string col)
Displays hidden column col in grid. If the column is already shown or does not exist, does nothing.
If the column is displayed for first time (it was hidden by XML <C Visible='0'/> or is set <Cfg FastColumns='0'/> the displaying of the column can be slow.
Since 7.0 it never does Render.
upd 7.0 API method void

HideCol

(string col)
Hides visible column col. If the column is already hidden or does not exist, does nothing.
Since 7.0 it never does Render.
chg 7.0 API method void

ChangeColsVisibility

(string[ ] Show, string[ ] Hide, bool prefer = 0)
Changes visibility of given columns.
Show - an array of column names to show
Hide - array of column names to hide
If column is present in both arrays, it will be shown for prefer = 0 or hidden for prefer = 1.
Since 7.0 it never require Render and always returns null.
new 12.0 API event bool

OnColShow

(TGrid grid, string col, bool hide)
Called when the column will be shown (hide = 0) or hidden (hide = 1).
Return true to suppress the action.
<Actions>

HideCol ...F

Not assigned to any event
Hides actual or focused column.
new 12.0 <Actions>

HideCols ...F

Not assigned to any event
Hides focused columns. Version without ...F fails if the actual cell is not focused.
new 12.0 <Actions>

HideSelectedCols ...F

Not assigned to any event
Hides selected columns. Version without ...F fails if the actual column is not selected.
<Actions>

ShowColLeft ...F

Not assigned to any event
Shows hidden column on left side from actual or focused cell.
<Actions>

ShowColRight ...F

Not assigned to any event
Shows hidden column on right side from actual or focused cell.
new 12.0 <Actions>

ShowCols ...F

Not assigned to any event
Shows all hidden columns in focused range. Version without ...F fails if the actual cell is not focused.
new 12.0 <Actions>

ShowAllCols

Not assigned to any event
Shows all hidden columns in grid.

Columns visibility menu

Visible columns can be chosen in configuration menu, in Columns visibility menu or in TreeGrid options menu.
For more information see Configuration menu.