plotly / dash-ag-grid

Dash AG Grid is a high-performance and highly customizable component that wraps AG Grid, designed for creating rich datagrids.
https://dash.plotly.com/dash-ag-grid
MIT License
175 stars 25 forks source link

How To Pass a JavaScript Function to rowStyle or getRowStyles Property #264

Closed quecksilberio closed 6 months ago

quecksilberio commented 9 months ago

Is it possible to somehow pass a JavaScript function to the rowStyle or getRowStyles attribute, similarily to the way I can pass a JavaScript function to the cellStyle attribute?

I'm trying to dynamically update the row styles based on the data in that row and I cannot use the styleConditions mechanism since the rowStyle is a continuous function of my row data.

I'm trying to achieve something of the likes:

dag.AgGrid(rowStyle={'function': 'getMyRowStyle(params)'})

I'm trying to dynamically set the css background property of the rows like in the image attached. I currenty solved it by updating the individual cell styles but it is a lot more complex and very problematic when feeding the grid live data since only the cells that change redraw. This is why I'm trying to find a solution using the row styles instead of the cell styles.

Screenshot 2024-01-22 at 21 21 19
BSd3v commented 9 months ago

Hello @quecksilberio,

This should be available using the getRowStyle, rowStyle is for static assignment.

AnnMarieW commented 9 months ago

@quecksilberio - If you haven't solved this, please feel free to post your question on the Dash community forum and include a minimal example to show what you've tried so far. Here's a related post you might find helpful.