Skip to content

Commit bdb8f17

Browse files
committed
Fix: make interactive_table work with no selected_rows
1 parent 329a38b commit bdb8f17

File tree

5 files changed

+11
-5
lines changed

5 files changed

+11
-5
lines changed

docs/changelog.md

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

4+
2.2.1 (2024-09-22)
5+
------------------
6+
7+
**Fixed**
8+
- We fixed an issue with the Streamlit component when `selected_rows` was not set.
9+
10+
411
2.2.0 (2024-09-22)
512
------------------
613

src/itables/javascript.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -598,7 +598,7 @@ def warn_if_selected_rows_are_not_visible(
598598
selected_rows, full_row_count, data_row_count, warn_on_selected_rows_not_rendered
599599
):
600600
if selected_rows is None:
601-
return None
601+
return []
602602

603603
if not all(isinstance(i, int) for i in selected_rows):
604604
raise TypeError("Selected rows must be integers")

src/itables/shiny.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,15 +29,14 @@ def init_itables(
2929
return html
3030

3131

32-
def DT(df, caption=None, table_id=None, selected_rows=None, **kwargs):
32+
def DT(df, caption=None, table_id=None, **kwargs):
3333
"""This is a version of 'to_html_datatable' that works in Shiny applications."""
3434

3535
html = to_html_datatable(
3636
df,
3737
caption=caption,
3838
table_id=table_id,
3939
connected=_CONNECTED,
40-
selected_rows=selected_rows or [],
4140
**kwargs,
4241
)
4342

src/itables/version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
"""ITables' version number"""
22

3-
__version__ = "2.2.0"
3+
__version__ = "2.2.1"

src/itables/widget/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ def __init__(self, df=None, caption=None, selected_rows=None, **kwargs) -> None:
4141
self.caption = other_args.pop("caption") or ""
4242
self.classes = other_args.pop("classes")
4343
self.style = other_args.pop("style")
44-
self.selected_rows = other_args.pop("selected_rows") or []
44+
self.selected_rows = other_args.pop("selected_rows")
4545

4646
self._data = dt_args.pop("data")
4747
self._columns = dt_args.pop("columns")

0 commit comments

Comments
 (0)