Skip to content

updates on create_visualisations page in microgrowth to make the sele… - #51

Merged
enryH merged 7 commits into
mainfrom
make_plot_parameters_consistent
Jul 17, 2026
Merged

updates on create_visualisations page in microgrowth to make the sele…#51
enryH merged 7 commits into
mainfrom
make_plot_parameters_consistent

Conversation

@sambra95

@sambra95 sambra95 commented Jul 6, 2026

Copy link
Copy Markdown
Collaborator

updated create_visualizations page to save plotting parameters in session state so that they persist between pages

…cted plotting parameters persist between pages
@sambra95
sambra95 requested a review from enryH July 6, 2026 14:18
pre_selected_rows = [idx for idx, sid in enumerate(ids) if sel.get(sid, False)]

# Re-check stored selection on (re)mount; pre_selected_rows is unreliable.
grid_options["getRowId"] = JsCode(

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

so you only use Javascript code to check the stored variables? I find it a bit weird to see that here

Comment thread MicroGrowth/src/ui_functions/create_visualizations_ui.py
@sambra95
sambra95 force-pushed the make_plot_parameters_consistent branch from f79b2ba to 1e12cbf Compare July 10, 2026 06:30
@enryH

enryH commented Jul 10, 2026

Copy link
Copy Markdown
Collaborator

Is this ready?

enryH and others added 2 commits July 10, 2026 12:57
Drop the JsCode-based re-check of preselected AgGrid rows on mount
(flagged in review as odd to see JS for this). Instead, only persist
the checked rows into session state when the user clicks a "Save
selection" button, so navigating away and back no longer wipes the
saved selection just because the grid remounts unchecked.

@sambra95 sambra95 left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i agree that the js solution is clunky. this solution does not work. the selected rows are not saved when i navigate to a different page and back again - even when i click the selection button

claude and others added 3 commits July 16, 2026 16:47
The previous "Save selection" button still read live state off an
AgGrid component, which remounts unchecked on page navigation - so
clicking Save after navigating back silently wrote an empty selection
over the previously saved one. st.data_editor is a first-party
Streamlit widget whose checked state is rebuilt from session state on
every render, so it reflects the saved selection correctly right after
navigating back, and Save now reliably captures what's shown. Also
drops the now-unused streamlit-aggrid dependency.
@enryH
enryH merged commit 613c0c0 into main Jul 17, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants