React Data GridRow 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.
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
Group Node Attributes
Row Node Methods
| Select (or deselect) the node.
| |
| Returns: true if node is selected. false if the node isn't selected. undefined if it's partially selected (group where not all children are selected).
| |
| Returns: true if node is either pinned to the top or bottom . false if the node isn't pinned.
| |
| Returns: true if the node can be expanded, i.e it is a group or master row. false if the node cannot be expanded.
| |
| Set the expanded state of this rowNode. Pass true to expand and false to collapse.
| |
| Returns: true if the node is currently hovered. false if the node is not hovered.
| |
| Returns: true if the node is a full width cell. false if the node is not a full width cell.
| |
| Add an event listener.
| |
| Remove event listener.
| |
| 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 .
| |
| Perform a depth-first search of this node and its children.
| |
| 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
| |
| Updates the data on the rowNode . When this method is called, the grid will refresh the entire rendered row if it is displayed.
| |
| 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.
| |
| 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.
|
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 listener
var selectionChangedCallback = () => {
// 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
:
| Row was selected or unselected.
| |
| Mouse has entered the row.
| |
| Mouse has left the row.
| |
| One cell value has changed.
| |
| allChildrenCount has changed.
| |
| rowData has changed.
| |
| rowHeight has changed.
| |
| rowTop has changed.
| |
| firstChild has changed.
| |
| lastChild has changed.
| |
| childIndex has changed.
| |
| rowIndex has changed.
| |
| expanded has changed.
| |
| uiLevel has changed.
|