Just like we can add CSS class using ag grid. Is there any way in ag grid to add attribute\s at row and cell level.
const gridOptions = {
// all rows assigned CSS class 'my-green-class'
rowClass: 'my-green-class',
// all even rows assigned 'my-shaded-effect'
getRowClass: params => {
if (params.node.rowIndex % 2 === 0) {
return 'my-shaded-effect';
}
},
// other grid options ...
For example I want like "my-custom-attr="dummyValue" below
<div comp-id="44" my-custom-attr="dummyValue" style="transform: translateY(0px); height: 42px;" row-index="0" aria-rowindex="2" class="ag-row-even ag-row-no-focus ag-row ag-row-level-0 ag-row-position-absolute ag-row-first" role="row" row-id="0"><div comp-id="63" class="ag-cell ag-cell-not-inline-editing ag-cell-normal-height ag-cell-value" tabindex="-1" role="gridcell" aria-colindex="2" col-id="sickDays" unselectable="on" style="left: 200px; width: 200px;">4</div></div>
I would look into cell renders. https://www.ag-grid.com/javascript-data-grid/cell-rendering/
You could then add your attr to the cell by returning
return (
<div my-attr="asdffasdf">
{params.data.cellValue}
</div>
)