Skip to content

Commit

Permalink
Ensure Tabulator data is updated after filters are changed (#7074)
Browse files Browse the repository at this point in the history
  • Loading branch information
philippjfr authored Aug 6, 2024
1 parent e7afa8a commit a33d277
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
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

0 comments on commit a33d277

Please sign in to comment.