S
Solara6mo ago
Wyvn

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
MaartenBreddels
MaartenBreddels6mo ago
el = Grid.element(
grid_data=grid_data,
grid_options=grid_options,
theme=theme,
**kwargs,
).key(f"theme-{theme}")
el = Grid.element(
grid_data=grid_data,
grid_options=grid_options,
theme=theme,
**kwargs,
).key(f"theme-{theme}")
This is the best I can do. I think ipyaggrid does not support updating the theme. Maybe @mariobuikhuizen has a better idea.
Monty Python
Monty Python6mo ago
ipyaggrid/builder_params.py line 41
li_theme = [
li_theme = [
MaartenBreddels
MaartenBreddels6mo ago
The problem is it doesn’t dynamically update when you change it
Wyvn
WyvnOP6mo ago
Correct, that's the issue. But the .key fix seems to work! Thanks
MaartenBreddels
MaartenBreddels6mo ago
It forces the recreation of the Widget, so any state of the widget not captured by a state outside the widget might get lost
Wyvn
WyvnOP6mo ago
As a side question - any plans on updating the ipyaggird past version 28?
mariobuikhuizen
mariobuikhuizen6mo ago
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?
Wyvn
WyvnOP6mo ago
Better built in cell editors, grid state saving, even auto dark/light theming.

Did you find this page helpful?