Row Object (aka Row Node)

A Row Node represents one row of data. The Row Node will contain a reference to the data item your application provided as well as other runtime information about the row. The Row Node contains attributes, methods and emits events. Additional attributes are used if the Row Node is a group.

All Row Node Attributes

idUnique ID for the node. Either provided by the application, or generated by the grid if not.
dataThe data as provided by the application.
parentThe parent node to this node, or empty if top level.
levelHow many levels this node is from the top when grouping.
uiLevelHow many levels this node is from the top when grouping in the UI (only different to parent when groupRemoveSingleChildren=true).
grouptrue if this node is a group node (i.e. has children).
rowPinned'top' or 'bottom' if pinned row, otherwise null or undefined.
canFlowertrue if this node can flower (i.e. can be expanded, but has no direct children).
childFlowerThe child flower of this node.
childIndexIndex of this row with respect to its parent when grouping. Changes when data is sorted.
firstChildtrue if this is the first child in this group. Changes when data is sorted.
lastChildtrue if this is the last child in this group. Changes when data is sorted.
stubUsed by server-side row model. true if this row node is a stub. A stub is a placeholder row with loading icon while waiting from row to be loaded.
rowHeightThe row height in pixels.
rowTopThe row top position in pixels.
quickFilterAggregateTextIf using quick filter, stores a string representation of the row for searching against.

Group Node Attributes

groupDataIf using grid grouping, contains the group values for this group.
aggDataIf using grid grouping and aggregation, contains the aggregation data.
keyThe key for the grouping e.g. Ireland, UK, USA.
fieldThe field (string) we are grouping on e.g. 'country'.
rowGroupColumnThe row group column used for this group, e.g. the Country column instance.
rowGroupIndexIf doing in-memory (client-side) grouping, this is the index of the group column this cell is for. This will always be the same as the level, unless we are collapsing groups, i.e. groupRemoveSingleChildren=true.
expandedtrue if group is expanded, otherwise false.
footertrue if row is a footer. Footers have group = true and footer = true.
allLeafChildrenAll lowest level nodes beneath this node, no groups.
childrenAfterGroupChildren of this group. If multi levels of grouping, shows only immediate children.
childrenAfterFilterFiltered children of this group.
childrenAfterSortSorted children of this group.
allChildrenCountNumber of children and grandchildren.
leafGrouptrue if this node is a group and the group is the bottom level in the tree.
siblingIf using footers, reference to the footer node for this group.

Row Node Methods

setSelected(newValue: boolean, clearSelection: boolean)Select (or deselect) the node. newValue=true for selection, newValue=false for deselection. If selecting, then passing true for clearSelection will select the node exclusively (i.e. NOT do multi select). If doing deselection, clearSelection has no impact.
isSelected()Returns true if node is selected, otherwise false.
addEventListener(eventType: string, listener: Function)Add an event listener. Currently only rowSelected event supported.
removeEventListener(eventType: string, listener: Function)Remove event listener.
resetQuickFilterAggregateText()The first time quickFilter runs, the grid creates a one-off string representation of the row. This string is then used for the quick filter instead of hitting each column separately. When you edit, using grid editing, this string gets cleared down. However if you edit without using grid editing, you will need to clear this string down for the row to be updated with the new values. Otherwise new values will not work with the quickFilter.
depthFirstSearch(callback)Perform a depth-first search of this node and its children.
setRowHeight(height)Sets the row height. Call if you want to change the height initially assigned to the row. After calling, you must call api.onRowHeightChanged() so the grid knows it needs to work out the placement of the rows.
setData(newData)Sets the data for this item. Results in the entire row getting refreshed.

Events on Row Nodes

The following events can be listened to on rowNodes:

rowSelectedRow was selected or unselected.
mouseEnterMouse has entered the row.
mouseLeaveMouse has left the row.
cellChangedOne cell value has changed.
allChildrenCountChangedallChildrenCount has changed.
dataChangedrowData has changed.
heightChangedrowHeight has changed.
topChangedrowTop has changed.
firstChildChangedfirstChild has changed.
lastChildChangedlastChild has changed.
childIndexChangedchildIndex has changed.
rowIndexChangedrowIndex has changed.
expandedChangedexpanded has changed.
uiLevelChangeduiLevel has changed.

All events fired by the rowNode are synchronous (events are normally asynchronous). The grid is also listening for these events internally. This means that when you receive an event, the grid may still have some work to do (e.g. if rowTop changed, the grid UI may still have to update to reflect this change). It is also best you do not call any grid API functions while receiving events from the rowNode (as the grid is still processing). Instead, it is best to put your logic into a timeout and call the grid in another VM tick.

When adding event listeners to a row, they will stay with the row until the row is destroyed. This means if the row is taken out of memory (pagination or virtual paging) then the listener will be removed. Likewise, if you set new data into the grid, all listeners on the old data will be removed.

Be careful when adding listeners to rowNodes in cell renderers that you remove the listener when the rendered row is destroyed due to row virtualisation. You can cater for this as follows:

var renderer = function(params) { // add listener var selectionChangedCallback = function () { // some logic on selection changed here console.log('node selected = ' + params.node.isSelected()); }; params.node.addEventListener(RowNode.EVENT_ROW_SELECTED, selectionChangedCallback); // remove listener on destroy params.addRenderedRowEventListener('renderedRowRemoved', function() { params.node.removeEventListener(RowNode.EVENT_ROW_SELECTED, selectionChangedCallback); } return params.value; }