ipyaggrid switch between light and dark mode
I've not been able to figure out how to get the ipyaggrid to switch between light and dark mode without a screen refresh. Attached is an example. If I have the Tabs on lazy mode it will force a re-render.
https://py.cafe/wyvnthewolf/solara-aggrid-dark-mode-toggle
Any insight would be appreciated.
PyCafe - Solara - Solara with AG Grid Example
Create & Share Streamlit, Dash and Python Apps Online.
9 Replies
This is the best I can do. I think ipyaggrid does not support updating the theme.
Maybe @mariobuikhuizen has a better idea.
yeah, you can use
ag-theme-dark
as dark theme
Theme must be one of: https://github.com/widgetti/ipyaggrid/blob/f04d14ec6fe84b08e8d786e99c39208b8b19b8b9/ipyaggrid/builder_params.py#L41C1-L50C10ipyaggrid/builder_params.py
line 41
The problem is it doesn’t dynamically update when you change it
Correct, that's the issue. But the .key fix seems to work! Thanks
It forces the recreation of the Widget, so any state of the widget not captured by a state outside the widget might get lost
As a side question - any plans on updating the ipyaggird past version 28?
ah, no, theme isn't wired to update on change in ipyaggrid I see now. It did seem to work when I tried it on py.cafe, but that was the hot reload.
Not plans yet. Anything specific you need from the newer versions?
Better built in cell editors, grid state saving, even auto dark/light theming.