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

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

Open
maximlt opened this issue Nov 19, 2024 · 0 comments
Open

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

maximlt opened this issue Nov 19, 2024 · 0 comments
Labels
component: tabulator Related to the Tabulator widget type: bug Something isn't correct or isn't working

Comments

@maximlt
Copy link
Member

maximlt commented Nov 19, 2024

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

@maximlt maximlt added type: bug Something isn't correct or isn't working component: tabulator Related to the Tabulator widget labels Nov 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component: tabulator Related to the Tabulator widget type: bug Something isn't correct or isn't working
Projects
None yet
Development

No branches or pull requests

1 participant