Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ensure Tabulator data is updated after filters are changed #7074

Merged
merged 2 commits into from
Aug 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions panel/tests/widgets/test_tables.py
Original file line number Diff line number Diff line change
Expand Up @@ -1312,6 +1312,14 @@ def test_tabulator_patch_with_filters(document, comm):
table.value[col].values, expected_df[col]
)

table.filters = []

for col, values in model.source.data.items():
expected = expected_df[col]
if col == 'D':
expected = expected.astype(np.int64) / 10e5
np.testing.assert_array_equal(values, expected)

def test_tabulator_patch_with_sorters(document, comm):
df = makeMixedDataFrame()
table = Tabulator(df, sorters=[{'field': 'A', 'sorter': 'number', 'dir': 'desc'}])
Expand Down
2 changes: 1 addition & 1 deletion panel/widgets/tables.py
Original file line number Diff line number Diff line change
Expand Up @@ -1609,7 +1609,7 @@ def _patch(self, patch):
def _update_cds(self, *events):
if any(event.name == 'filters' for event in events):
self._edited_indexes = []
page_events = ('page', 'page_size', 'sorters', 'filters')
page_events = ('page', 'page_size', 'sorters')
if self._updating:
return
elif events and all(e.name in page_events[:-1] for e in events) and self.pagination == 'local':
Expand Down
Loading