Skip to content

Tabulator: wrong selection displayed on the front-end with add_filter #7505

Open
@maximlt

Description

The wrong Tabulator row is selected in the front-end when the data is filtered with add_filter. The front-end seems to use the index of the selected row from the whole DataFrame (I'm selecting the row 2 in the whole df) which is incorrect when the data is filtered. It doesn't seem to affect header_filter.

import panel as pn
import pandas as pd

df = pd.DataFrame({"idx": ["idx0", "idx1", "idx2", "idx3", "idx4"], "col": ["a", "aa", "b", "bb", "bbb"]})
w_pat = pn.widgets.Select(value="b", options=["a", "b"])
w = pn.widgets.Tabulator(df, selectable=1)

def f(df, pattern):
    return df[df['col'].str.contains(pattern)]

w.add_filter(pn.bind(f, pattern=w_pat))
pn.Column(w_pat, w).servable()

Image

Metadata

Assignees

No one assigned

    Labels

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions