Skip to content

Commit

Permalink
Fix: make interactive_table work with no selected_rows
Browse files Browse the repository at this point in the history
  • Loading branch information
mwouts committed Sep 22, 2024
1 parent 329a38b commit bdb8f17
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 5 deletions.
7 changes: 7 additions & 0 deletions docs/changelog.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
ITables ChangeLog
=================

2.2.1 (2024-09-22)
------------------

**Fixed**
- We fixed an issue with the Streamlit component when `selected_rows` was not set.


2.2.0 (2024-09-22)
------------------

Expand Down
2 changes: 1 addition & 1 deletion src/itables/javascript.py
Original file line number Diff line number Diff line change
Expand Up @@ -598,7 +598,7 @@ def warn_if_selected_rows_are_not_visible(
selected_rows, full_row_count, data_row_count, warn_on_selected_rows_not_rendered
):
if selected_rows is None:
return None
return []

if not all(isinstance(i, int) for i in selected_rows):
raise TypeError("Selected rows must be integers")
Expand Down
3 changes: 1 addition & 2 deletions src/itables/shiny.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,15 +29,14 @@ def init_itables(
return html


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

html = to_html_datatable(
df,
caption=caption,
table_id=table_id,
connected=_CONNECTED,
selected_rows=selected_rows or [],
**kwargs,
)

Expand Down
2 changes: 1 addition & 1 deletion src/itables/version.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
"""ITables' version number"""

__version__ = "2.2.0"
__version__ = "2.2.1"
2 changes: 1 addition & 1 deletion src/itables/widget/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ def __init__(self, df=None, caption=None, selected_rows=None, **kwargs) -> None:
self.caption = other_args.pop("caption") or ""
self.classes = other_args.pop("classes")
self.style = other_args.pop("style")
self.selected_rows = other_args.pop("selected_rows") or []
self.selected_rows = other_args.pop("selected_rows")

self._data = dt_args.pop("data")
self._columns = dt_args.pop("columns")
Expand Down

0 comments on commit bdb8f17

Please sign in to comment.