Column API
TreeGrid documentation
In TreeGrid is column referenced always by its
name as string.
By API there are accessible all grid columns set in XML and all their attributes and some runtime attributes. The columns are accessible by
grid.Cols array as array of TCol objects.
Every column object contains its input XML attributes set by <C> tag, like Name, Width, Format etc.
API variable TCol[ ]
Cols
read only JavaScript named array of column objects
All column objects accessible by their names, like grid.Cols[col].
All grid column
objects can be iterated by
for(var col in grid.Cols){ var C = grid.Cols[col]; ... } - it iterates randomly not by their positions.
chg 7.0 API variable string[ ][ ]
ColNames
read only three (or more) JavaScript index arrays of column names
Three arrays for the column sections ColNames[0] - left, [1] - mid, [2] - right. The array exists even if the section was not defined in XML.
Every array contains the column names sorted according to the position inside the section.
To iterate all column use such loops:
for(var s=0;s<3;s++) for(var c=0;c<grid.ColNames[s].length;c++){ var col = grid.ColNames[s][c]; ... }
To iterate all visible columns you can use such loop
for(var col = grid.GetFirstCol();col;col = grid.GetNextCol(col)) { ... }
(New 7.0) When set
ColPaging, it contains column pages, can be more than 3, in this structure: 0 Left, 1 - (N-2) Mid, (N-1) Right, where N is the
ColNames.length
new 6.0 API method string[ ]
GetCols
(string attr1, string attr2)
Returns all columns (their names) in grid, in correct order in table.
If set
attr1 and/or
attr2, returns only columns that have set these attributes.
For example call
grid.GetCols ("Visible","CanExport") to get all exportable columns.
API method int[ ]
GetSections
( )
Returns first and last actually visible section in grid [
c1,
c2].
c1 is
0 if left cols are visible,
1 otherwise,
c2 is
3 if right cols are visible otherwise
2.
API method string
GetFirstCol
(int sec = null)
Returns first visible column in grid or null.
If set
sec to column section index (0 - left, 1 - mid, 2 - right), it returns first visible column in given section or null.
API method string
GetLastCol
(int sec = null)
Returns last visible column in grid or null.
If set
sec to column section index (0 - left, 1 - mid, 2 - right), it returns last visible column in given section or null.
API method string
GetNextCol
(string col)
Returns next visible column according to its position.
To iterate all visible columns you can use such loop
for(var col = grid.GetFirstCol();col;col = grid.GetNextCol(col)) { ... }
API method string
GetPrevCol
(string col)
Returns previous visible column according to its position.
API method string
GetCaption
(string col)
Returns column caption displayed in the first header - Header.