Closed DatDucati closed 3 weeks ago
Hi all,
I encounter the very same bug with panel version 1.3.0.
Is there any work around at the moment?
You can solve / work around your problem as follows. event.obj.current_view
will give you the current, filtered view of the data. You can index into that using event.new
, which is the iloc
of the selection.
However, there is still a bug in tabulator. The indexing on a selection event (so what's in event.new
) is inconsistent. When the data is sorted (by clicking a header label), event.new
will give the location of the selected row in the original, unsorted view. So in this case, we need to index into the df using tabulator.value
(or event.obj.value
). If that weren't the case we could always use event.obj.current_view
. So it either needs to always provide the iloc
of the current view, or always the index of the original view, but not mix them.
It's possible to work around this by writing custom code that inspects event.obj.filters
and event.obj.sorters
, but better to fix the behavior of course.
Sorry for the long, long delay here. This has now been fixed in https://github.com/holoviz/panel/pull/7058
ALL software version info
(this library, plus any other relevant software, e.g. bokeh, python, notebook, OS, browser, etc)
Description of expected behavior and the observed behavior
Tabulator does not update its internal dataframe (or at least the indexes) if the dataframe is filtered.
See the example, if you filter by 'Astrometry' and select the first element, you will get index [0] (rowid=1), instead of [113] (rowid=114).
Complete, minimal, self-contained example code that reproduces the issue
app.py:
mainLayout.py:
Screenshots or screencasts of the bug in action
https://user-images.githubusercontent.com/9201509/200301976-93782dca-dfa3-41dd-af90-f28ebdb3d626.mov