Skip to content

Commit ba57c8e

Browse files
committed
Use the same default parameters and style in Streamlit and notebooks
Remove unnecessary scrollX
1 parent 433484b commit ba57c8e

File tree

16 files changed

+210
-141
lines changed

16 files changed

+210
-141
lines changed

docs/advanced_parameters.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ You can replace the pagination with a [vertical scroll](https://datatables.net/e
135135
show(df, scrollY="200px", scrollCollapse=True, paging=False)
136136
```
137137

138-
In the context of the notebook, a horizontal scroll bar should appear when the table is too wide. In other contexts like here in Jupyter Book, you might want to use `scrollX = True`.
138+
Since ITables 2.1.2, the `.dt-layout-table` div has a default overflow equal to `auto`, so in most cases you won't need to use the `scrollX` option of datatables.
139139

140140
## Footer
141141

docs/changelog.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,14 @@
11
ITables ChangeLog
22
=================
33

4+
2.1.2 (2024-06-19)
5+
------------------
6+
7+
**Changed**
8+
- The default CSS contains now has `overflow:auto` on `div.dt-layout-table>div`. Thanks to this we now get
9+
an automatic horizontal scrolling in Jupyter, Jupyter Book and also Streamlit if the table is too wide ([#282](https://github.com/mwouts/itables/pull/282)).
10+
11+
412
2.1.1 (2024-06-08)
513
------------------
614

docs/custom_css.md

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -113,9 +113,9 @@ show(df, classes="display nowrap table_with_monospace_font")
113113
The `show` function has a `style` argument that determines the
114114
style for that particular table.
115115

116-
The default value for `style` is `"table-layout:auto;width:auto;margin:auto;caption-side:bottom"`. When `scrollX` is `True`, `margin:auto` gets replaced with `margin:0` to avoid misaligned headers.
117-
Without `width:auto`, tables with few columns still take the full notebook width in Jupyter.
118-
Using `margin:auto` makes non-wide tables centered in Jupyter.
116+
The default value for `style` is `"table-layout:auto;width:auto;margin:auto;caption-side:bottom"`.
117+
Without `width:auto`, tables with few columns are stretched to fit the container width.
118+
Using `margin:auto` makes non-wide tables centered.
119119

120120
## Position and width
121121

@@ -152,7 +152,6 @@ You can set a fixed width for all the columns with `"targets": "_all"`:
152152
show(
153153
df,
154154
columnDefs=[{"width": "120px", "targets": "_all"}],
155-
scrollX=True,
156155
style="width:1200px",
157156
autoWidth=False,
158157
)

docs/polars_dataframes.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -148,15 +148,15 @@ show(dict_of_test_dfs["int_float_str"])
148148
```{code-cell}
149149
:tags: [full-width]
150150
151-
show(dict_of_test_dfs["wide"], maxBytes=100000, maxColumns=100, scrollX=True)
151+
show(dict_of_test_dfs["wide"], maxBytes=100000, maxColumns=100)
152152
```
153153

154154
## long_column_names
155155

156156
```{code-cell}
157157
:tags: [full-width]
158158
159-
show(dict_of_test_dfs["long_column_names"], scrollX=True)
159+
show(dict_of_test_dfs["long_column_names"])
160160
```
161161

162162
## named_column_index

docs/streamlit.md

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
ITables in version `2.1.0` or above can be used in Streamlit.
44

5-
To render a DataFrame with ITables in a Streamlit app, use `interactive_table`:
5+
To render a DataFrame with ITables in a Streamlit app, use `itables.streamlit.interactive_table`:
66
```
77
from itables.streamlit import interactive_table
88
```
@@ -11,9 +11,6 @@ The function `interactive_table` accepts the same arguments as `show` and `to_ht
1111
first argument is the dataframe that will be displayed, and then you
1212
can set a `caption`, custom `classes` or `style`, and even activate the `buttons` extension, etc...
1313

14-
Unlike `show`, `interactive_table` has `scrollX=True` by default. This makes the
15-
rendering of wide tables more similar to that of `show` in Notebooks.
16-
1714
## A sample application
1815

1916
A sample Streamlit application is available at [itables.streamlit.app](https://itables.streamlit.app) (source code [here](https://github.com/mwouts/demo_itables_in_streamlit/blob/main/itables_app.py))

packages/dt_for_itables/CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
# 2.0.11 (2024-06-??)
2+
3+
**Added**
4+
- The default CSS contains has `overflow:auto` on `.dt-layout-table>div`. This improves the horizontal scrolling in Jupyter, and discards the need for `scrollX` in Streamlit ([#282](https://github.com/mwouts/itables/pull/282))
5+
6+
17
# 2.0.10 (2024-06-08)
28

39
**Added**

0 commit comments

Comments
 (0)