S
Solara2mo 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
MaartenBreddels2mo 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 Python2mo ago
ipyaggrid/builder_params.py line 41
li_theme = [
li_theme = [
MaartenBreddels
MaartenBreddels2mo ago
The problem is it doesn’t dynamically update when you change it
Wyvn
WyvnOP2mo ago
Correct, that's the issue. But the .key fix seems to work! Thanks
MaartenBreddels
MaartenBreddels2mo 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
WyvnOP2mo ago
As a side question - any plans on updating the ipyaggird past version 28?
mariobuikhuizen
mariobuikhuizen2mo 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
WyvnOP2mo ago
Better built in cell editors, grid state saving, even auto dark/light theming.
Want results from more Discord servers?
Add your server