Skip to content

Commit

Permalink
Fix the demo shiny app with tabs
Browse files Browse the repository at this point in the history
  • Loading branch information
mwouts committed Aug 10, 2024
1 parent ec67fff commit 7c4f89c
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 3 deletions.
1 change: 1 addition & 0 deletions docs/changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ ITables ChangeLog

**Fixed**
- We have adjusted the generation of the Polars sample dataframes to fix the CI ([Polars-18130](https://github.com/pola-rs/polars/issues/18130))
- The test on the Shiny app fallbacks to `ui.nav_panel` when `ui.nav` is not available


2.1.4 (2024-07-03)
Expand Down
2 changes: 1 addition & 1 deletion tests/sample_python_apps/itables_in_a_shiny_app.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# Run this app with "shiny run file.py"
from shiny import App, ui

from itables.sample_dfs import get_countries
Expand All @@ -8,4 +9,3 @@
app_ui = ui.page_fluid(ui.HTML(DT(df)))

app = App(app_ui, server=None)
# app.run()
10 changes: 8 additions & 2 deletions tests/sample_python_apps/itables_in_a_shiny_app_with_tabs.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,20 @@
# Run this app with "shiny run file.py"
from shiny import App, ui

from itables.sample_dfs import get_dict_of_test_dfs
from itables.shiny import DT

try:
# This one is not available on the CI (Python 3.8)
ui_nav = ui.nav
except AttributeError:
ui_nav = ui.nav_panel

app_ui = ui.page_fluid(
# Display the different tables in different tabs
ui.navset_tab(
*[ui.nav(name, ui.HTML(DT(df))) for name, df in get_dict_of_test_dfs().items()]
*[ui_nav(name, ui.HTML(DT(df))) for name, df in get_dict_of_test_dfs().items()]
)
)

app = App(app_ui, server=None)
# app.run()

0 comments on commit 7c4f89c

Please sign in to comment.