I'm trying to style a row based on an external value in the parent of grid. I've tried using getRowClass
and rowClassRules
but I don't seem to have access to any data that isn't directly inside of the params
value provided. Will I have to add the value of state I'm trying to access to params
?
For example, here is something similar to what I'm trying to do:
getRowClass: params => {
if (params.data.id === MAIN_ITEM_ID) return 'selected-border';
else if (SELECTED_ITEM_IDS.includes(params.data.id)) return 'selected';
}
The MAIN_ITEM_ID
and SELECTED_ITEM_IDS
are being set/updated whenever the onSelectionChanged
function is run. And I the item that matches ID within MAIN_ITEM_ID
to have a border and the other selected rows (SELECTED_ITEM_IDS
) will just have a normal colored background