Hi!
I have Conditional Row Classes with my grid
rowClassRules = {
'closed-incident-row': 'params.data.is_closed == true && params.data.is_incident == true',
'closed-event-row': 'params.data.is_closed == true && params.data.is_incident == false',
'incident-row': 'params.data.is_closed == false && params.data.is_incident == true',
}
So my grid looks like this
Row classes work well. No questions to them.
In my grid I have a column with custom cellRenderer for rendering html link (the column ‘Описание’ or Description on the screenshot).
{
'field': 'description',
'headerName': 'Описание',
'flex': 1,
'cellRenderer': 'EventLink',
'wrapText': True,
}
dashAgGridComponentFunctions.js
var dagcomponentfuncs = (window.dashAgGridComponentFunctions = window.dashAgGridComponentFunctions || {});
dagcomponentfuncs.EventLink = function (props) {
let class_;
if (props.data.is_incident === true || props.data.is_closed === true) {
class_ = 'black-font';
} else {
class_ = 'white-font'
}
return React.createElement(
'a',
{
href: 'http://localhost:8050/event/' + props.data._id,
className: class_,
target: '_blank'
},
props.data.description
);
};
CSS styles
.closed-incident-row {
background-color: var(--mantine-color-red-5) !important;
background-image: linear-gradient(to right, var(--mantine-color-red-5), var(--mantine-color-red-5), var(--mantine-color-green-5) 70%) !important;
color: black !important;
}
.closed-event-row {
background-color: var(--mantine-color-green-5) !important;
color: black !important;
}
.incident-row {
background-color: var(--mantine-color-red-5) !important;
color: black !important;
}
.black-font {
color: black;
text-decoration: none;
}
.white-font {
color: whitesmoke;
text-decoration: none;
}
As you can see I want to make black font color in description column if any Conditional Row Class is applied.
The problem is when I update is_closed or is_incident columns via Transaction Update, only conditional row classes are applied but not the style in my EventLink function. I have to fully refresh the grid to rerender description column.