Row API

TreeGrid documentation

TRow is row JavaScript object. col is column name as string.

In TreeGrid rows are stored in the same way as in the input XML, the variable rows are placed inside pages (if the grid is not paged, to only one page) and the pages root is Body. <Head>, <Foot> and <Solid> rows are placed in the separated tags accessible by Head, Foot and Space variables.
Every row is represented by JavaScript object similar to HTMLElement. The rows can be iterated by firstChild / nextSibling variables or GetFirst / GetNext methods.
In this documentation, the row object is named as TRow, but this object name in fact does not exist.
All rows are accessible by their ids from Rows array.

All attributes loaded from XML data are in rows represented as properties with the same name. For example you can access row.Selected or row.Added or row.Col1CanEdit or row.Col1 as cell value.
There is not predefined type for attributes, it can be string or number, depending on many factors. Therefore if you expect boolean value, you cannot test it as if(row.Selected) but if(row.Selected-0).
For many attributes is better to read them by predefined methods as CanEdit, CanFocus and so on. Most of row's attributes are expected to be read only, thus don't change their values directly.
Generally, use predefined functions (if any) to read or change row's attribute values instead of accessing them directly.
Also use these properties as read only if possible. To get row's attribute use global function Get rather then direct access to attribute.

All other XML data (defaults, columns, panel, toolbar, pager, configuration menu, language texts) are represented as JavaScript object (or arrays of these objects accessed by name) with properties of same name as XML attributes. These properties has converted type, therefore numbers are always numbers not strings. But it depends on property value not on expected type (the conversion is universal).

Grid configuration (tag <Cfg>) is filled to properties of basic TGrid object. TGrid object has all properties named as <Cfg> tag attributes. Values are also converted by their value types.

In all functions columns are identified by its name (given in XML, <C Name="">). By this name column object can be got from TGrid.Cols array.

In HTML table is every row represented by one <tr> tag for every section (left columns, variable columns, right columns). You can access cell DOM by GetCell function.

Any grid on page can be accessed from global JavaScript array Grids. By its Index or by its id.
new 6.0 API variable TRow[ ]

Rows

read only JavaScript named array of row objects by their id
All rows in grid by their id. Including fixed and Space rows.
If the row has set its id neither in XML nor by IdNames, the id is automatically generated as "R"+number from 1.
upd 7.0 API method TRow

GetRowById

(string id, string attr, bool nofixed)
Searches for the row by its id.
If the row exists in Rows, it returns the row from Rows, otherwise it iterates all rows in grid to find the row.
The advantage to Rows is that it can be used also before the Rows array is filled during grid creating.
The disadvantage is that it will be slow when the Rows does not contain given id.
(Since 7.0) If set attr, it searches the row according to this attribute value instead of id, in this case it always iterates all the rows.
(Since 7.0) If set nofixed, it does not search in fixed and space rows.
renamed 6.0 API variable TRow

Body

read only
The parent of all pages in grid. The XML <Body> tag.
You can iterate the pages by firstChild / nextSibling attributes.
You can iterate the rows in page also firstChild / nextSibling attributes or by GetFirst / GetNext method.
renamed 6.0 API variable TRow

Head

read only
The parent of all fixed rows in Head section. The XML <Head> tag.
You can iterate them by firstChild / nextSibling attributes.
renamed 6.0 API variable TRow

Foot

read only
The parent of all fixed rows in Foot section. The XML <Foot> tag.
You can iterate them by firstChild / nextSibling attributes.
renamed 6.0 API variable TRow

Solid

read only
The parent of all Space rows. The XML <Solid> tag.
You can iterate them by firstChild / nextSibling attributes.
The rows are not positioned by its Space attribute, but by its position in XML.
renamed 6.0 API variable TRow

Header

read only
The main Header row in grid. (the header with id='Header').
API variable TRow

Toolbar

read only
The main Toolbar row in grid. (the toolbar with id='Toolbar')
new 6.0 API variable TRow

Filter

read only
The first filter row in grid.
API method TRow[ ]

GetFixedRows

( )
Returns all fixed rows (head and foot) as JavaScript array.
API variable int

RowCount

read only
Count of actually rendered variable rows.
This variable is set after page was rendered and is updated for every next page or child page or child part is rendered.
For non-paged grids, you can access this variable first in OnRenderPageFinish event handler.
new 7.0 API variable int

LoadedCount

read only
Count of actually loaded variable rows.
This variable is set after page was loaded and is updated for every next page or child page is loaded.
For non-paged grids, you can access this variable first in OnUpdated event handler.
API TRow var. string

Fixed

read only
It is set for fixed and space rows only.
For head rows is "Head", for foot rows is "Foot", for Space rows is "Solid".

Row iterating

API TRow var. TRow

nextSibling

read only The first letter is lower case
Next row below this row.
API TRow var. TRow

previousSibling

read only The first letter is lower case
Previous row above this row.
API TRow var. TRow

firstChild

read only The first letter is lower case
First child of the row in tree.
API TRow var. TRow

lastChild

read only The first letter is lower case
Last child of the row in tree.
API TRow var. TRow

parentNode

read only The first letter is lower case
Parent row in tree. For root row it returns page or Head / Foot / Solid section for fixed row.
API method TRow

GetFirst

(TRow parent, int type)
Returns first existing row in given page parent or children of the parent row.
If parent is null returns the first variable row.
if (type&4) - including head and foot rows.
API method TRow

GetLast

(TRow parent, int type)
Returns last existing row in given page parent or children of the parent row.
If parent is null returns the last variable row.
if (type&1) - ignores rows in collapsed parents, if (type&4) - including head and foot rows.
upd 13.2 API method TRow

GetNext

(TRow row, int type)
Returns next existing row below the given row.
if (type&1) - ignores rows in collapsed parents, if (type&2) - only from actual root page.
Since 13.2 if (type&4) - including head and foot rows.
upd 13.2 API method TRow

GetPrev

(TRow row, int type)
Returns previous existing row above the given row.
if (type&1) - ignores rows in collapsed parents, if (type&2) - only from actual root page.

Since 13.2 if (type&4) - including head and foot rows.
API method TRow

GetFirstVisible

(TRow parent, int type)
Returns first visible row (has Visible='1') in given page parent or children of the parent row.
If parent is null returns the first visible variable row.
if (type&4) - including head and foot rows.
API method TRow

GetLastVisible

(TRow parent, int type)
Returns last visible (has Visible='1') row in given page parent or children of the parent row.
If parent is null returns the last visible variable row.
if (type&1) - ignores rows in collapsed parents, if (type&4) - including head and foot rows.
upd 13.2 API method TRow

GetNextVisible

(TRow row, int type)
Returns next visible (has Visible='1') row below the given row.
if (type&1) - ignores rows in collapsed parents, if (type&2) - only from actual root page.
Since 13.2 if (type&4) - including head and foot rows.
upd 13.2 API method TRow

GetPrevVisible

(TRow row, int type)
Returns previous visible (has Visible='1') row above the given row.
if (type&1) - ignores rows in collapsed parents, if (type&2) - only from actual root page.
Since 13.2 if (type&4) - including head and foot rows.
API method object[ ]

GetPrevShift

(TRow row, int pagepos, int cnt)
Returns [TRow row, int pagepos] .
Returns previous visible row shifted by cnt rows above. row can be root page, in this case pagepos is used as row position in the page.
API method object[ ]

GetNextShift

(TRow row, int pagepos, int cnt)
Returns [TRow row, int pagepos] .
Returns next visible row shifted by cnt rows below. row can be root page, in this case pagepos is used as row position in the page.
upd 12.0 API method TRow

GetNextSibling

(TRow row, int type)
Returns next row on the same tree level, for root rows iterates through pages.
Since 12.0, type&1 - ignores rows in collapsed parents, type&2 - only from actual root page. type&4 also from next parents on the same level.
upd 12.0 API method TRow

GetNextSiblingVisible

(TRow row, int type)
Returns next visible row on the same tree level, for root rows iterates through pages.
Since 12.0, type&1 - ignores rows in collapsed parents, type&2 - only from actual root page. type&4 also from next parents on the same level.
new 10.0 upd 12.0 API method TRow

GetPrevSibling

(TRow row, int type)
Returns previous row on the same tree level, for root rows iterates through pages.
Since 12.0, type&1 - ignores rows in collapsed parents, type&2 - only from actual root page. type&4 also from previous parents on the same level.
new 10.0 upd 12.0 API method TRow

GetPrevSiblingVisible

(TRow row, int type)
Returns previous visible row on the same tree level, for root rows iterates through pages.
Since 12.0, type&1 - ignores rows in collapsed parents, type&2 - only from actual root page. type&4 also from previous parents on the same level.