Highlight the row on scroll
highlightedCells: { [key: string]: boolean } = {};
Apply in Ag-grid column Def
cellClassRules: {enter code here
'hightlighted-cell': (params: any) =>
this.highlightedCells[`${params.rowIndex}-${params.column.colId}`],
},
Below function called on click of Cell of Row (R1C2)
highlightAndScrollToCell(rowIndex: any, colKey: any) {
this.highlightedRowIndex = rowIndex;
this.highlightedColumnKey = colKey;
if (this.gridParams && rowIndex !== null && colKey) {
const cellKey = `${rowIndex}-${colKey}`;
this.highlightedCells[cellKey] = true;
this.gridParams.api.refreshCells({ force: true });
this.gridParams.api.ensureIndexVisible(rowIndex, 'middle');
this.gridParams.api.ensureColumnVisible(colKey);
this.gridParams.api.setFocusedCell(rowIndex, colKey);
}
}