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.
If using Typescript, Row Nodes' support a generic data type via IRowNode<TData>. If not set TData defaults to any. See Typescript Generics for more details.
All Row Node Attributes
id
string | undefined
Unique ID for the node. Either provided by the application, or generated by the grid if not.
data
TData | undefined
The data as provided by the application. Can be undefined when using row grouping or during grid initialisation.
displayed
boolean
This will be true if it has a rowIndex assigned, otherwise false.
rowPinned
RowPinnedType
Either 'top' or 'bottom' if row pinned, otherwise undefined or null.
If 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.
expanded
boolean
true if group is expanded, otherwise false.
footer
boolean
true if row is a footer. Footers have group = true and footer = true.
If using footers, reference to the footer node for this group.
Row Node Methods
setSelected
Function
Select (or deselect) the node.
newValue - true for selection, false for deselection.
clearSelection - If selecting, then passing true will select the node exclusively (i.e. NOT do multi select). If doing deselection, clearSelection has no impact.
suppressFinishActions - Pass true to prevent the selectionChanged from being fired. Note that the rowSelected event will still be fired.
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.
function resetQuickFilterAggregateText(): void;
depthFirstSearch
Function
Perform a depth-first search of this node and its children.
function depthFirstSearch(
callback: (rowNode: IRowNode<TData>) => void
): void;
setRowHeight
Function
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.
rowHeight - new height of the row
estimated - is this an estimated height. Default: false
function setRowHeight(
rowHeight: number | undefined | null,
estimated?: boolean
): void;
updateData
Function
Updates the data on the rowNode. When this method is called, the grid will refresh the entire rendered row if it is displayed.
function updateData(data: TData): void;
setData
Function
Replaces the data on the rowNode. When this method is called, the grid will refresh the entire rendered row if it is displayed.
See Client-Side Single Row Update.
function setData(data: TData): void;
setDataValue
Function
Replaces the value on the rowNode for the specified column. When complete, the grid will refresh the rendered cell on the required row only. Note: This method on fires onCellEditRequest when the Grid is on Read Only mode.
colKey The column where the value should be updated
newValue The new value
eventSource The source of the event
Returns: True if the value was changed, otherwise False.
See Client-Side Single Cell Update.
Returns the route of the row node. If the Row Node is a group, it returns the route to that Row Node. If the Row Node is not a group, it returns undefined.
See Server-Side Model: Open by Default.
function getRoute(): string[] | undefined;
Row Node Events
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:
init(params: ICellRendererParams){// add listenervarselectionChangedCallback=()=>{// some logic on selection changed here
console.log('node selected = '+ params.node.isSelected());};
params.node.addEventListener('rowSelected', selectionChangedCallback);// remove listener on destroy
params.api.addRenderedRowListener('virtualRowRemoved', params.rowIndex,()=>{
params.node.removeEventListener('rowSelected', selectionChangedCallback);}}
Events on Row Nodes
The following events can be listened to on rowNodes: