How to get the focused cell value at the time focussing on the cell by using the keyboard arrow keys
In order to modify the style of the selected rows and cell range we wrap ag-Grid in a div with a class name that will be used to target the ag-Grid row and cell styles. This way we can target different CSS rules based on the wrapping div's class name.
The different parts of the grid concerned with cell values are as follows: Value Getter: Instead of specifying colDef.field, you can use colDef.valueGetter to provide a function for getting cell values. This is more flexible than providing field values for specific cells. Value Formatters: Use formatters to format values.
There are different aspects of the grid that assist this. The different parts of the grid concerned with cell values are as follows: Value Getter: Instead of specifying colDef.field, you can use colDef.valueGetter to provide a function for getting cell values. This is more flexible than providing field values for specific cells.
How to get the focused cell value at the time focussing on the cell by using the keyboard arrow keys or use the onCellFocused event. After that you can use those properties to retrieve the raw value of the cell:
You can either get the focused cell by using
var focusedCell = gridOptions.api.getFocusedCell();
or use the onCellFocused event.
Both give you the following properties:
Use the row-index to retrieve the row-node:
var row = gridOptions.api.getDisplayedRowAtIndex(rowIndex);
After that you can use those properties to retrieve the raw value of the cell:
var cellValue = gridOptions.api.getValue(colKey, row.node)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With