Skip to content

Commit e6c55cb

Browse files
committed
Use fillable=False in output_widget
1 parent e6fb0d5 commit e6c55cb

File tree

4 files changed

+33
-2
lines changed

4 files changed

+33
-2
lines changed

apps/shiny/issue_360/app.py

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
from shiny import App, ui
2+
from shinywidgets import output_widget, render_widget
3+
4+
from itables.sample_dfs import get_countries
5+
from itables.widget import ITable
6+
7+
app_ui = ui.page_fluid(
8+
ui.h1("Issue #360"),
9+
ui.p("The table height is not correct"),
10+
output_widget("my_table", fillable=False),
11+
ui.p(
12+
"More content, should not hide the table (but it does when "
13+
"we don't set `fillable=False` in `output_widget`)"
14+
),
15+
)
16+
17+
18+
# Define server
19+
def server(
20+
input, # pyright: ignore[reportUnknownParameterType,reportMissingParameterType]
21+
output, # pyright: ignore[reportUnknownParameterType,reportMissingParameterType]
22+
session, # pyright: ignore[reportUnknownParameterType,reportMissingParameterType]
23+
):
24+
@render_widget
25+
def my_table(): # pyright: ignore[reportUnusedFunction]
26+
return ITable(df=get_countries(html=False))
27+
28+
29+
# Create the Shiny app
30+
app = App(app_ui, server) # pyright: ignore[reportUnknownArgumentType]

apps/shiny/itable_widget/app-core.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
selected="int_float_str",
1616
)
1717
),
18-
output_widget("my_table"),
18+
output_widget("my_table", fillable=False),
1919
ui.markdown("Selected rows"),
2020
ui.output_code("selected_rows"),
2121
title="Using the ITable Widget in a Shiny App",

docs/apps/shiny.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ from shinywidgets import output_widget
2929

3030
app_ui = ui.page_fluid(
3131
# ...
32-
output_widget("my_table"),
32+
output_widget("my_table", fillable=False),
3333
# ...
3434
)
3535
```

docs/changelog.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ ITables ChangeLog
1717
- The optional final semicolon in `style` argument is now supported again ([#386](https://github.com/mwouts/itables/issues/386))
1818
- The index of Pandas Style object is now rendered when non-trivial ([#393](https://github.com/mwouts/itables/issues/393))
1919
- We have made the CSS files compatible with the shadow dom used by Marimo ([#383](https://github.com/mwouts/itables/issues/383))
20+
- A workaround for the incorrect widget weight in Shiny is to use `fillable=False` in the `output_widget` ([#360](https://github.com/mwouts/itables/issues/360))
2021

2122

2223
2.4.0 (2025-05-17)

0 commit comments

Comments
 (0)