728x90
const onRowClicked = (e: RowClickedEvent) => {
gridApi?.redrawRows();
};
const rowStyle = (params: RowClassParams) => {
if (params.api.getFocusedCell()?.rowIndex === params.rowIndex) {
return { backgroundColor: 'yellow' };
}
};
<AgGriedReact
onGridReady={(event: GridReadyEvent) => setGridApi(event.api)}
rowData={rowData}
columnDefs={colDefs}
suppressRowClickSelection={true}
stopEditingWhenCellsLoseFocus={true}
onRowClicked={onRowClicked}
getRowStyle={rowtyle}
/>
row click 하면 row color 바뀌게
https://www.ag-grid.com/javascript-data-grid/view-refresh/
https://www.ag-grid.com/react-data-grid/row-styles/
반응형
'전.study' 카테고리의 다른 글
2023.05.19(금) (0) | 2023.05.19 |
---|---|
2023.03.16(목) (0) | 2023.03.16 |
2023.03.13(월) (0) | 2023.03.13 |
2023.03.09(목) (0) | 2023.03.09 |
2023.02.09(목) (0) | 2023.02.09 |