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

The header_filters parameter of the tabulator widget cause bug when it is embedded in another tabulator #3597

Open
c-stephan opened this issue Jun 9, 2022 · 0 comments
Labels
component: tabulator Related to the Tabulator widget

Comments

@c-stephan
Copy link
Contributor

ALL software version info

panel-0.13.1

Context

I tried to create a tabulator widget with row_content, this content is another tabulator widget. Everything worked perfectly until I tried to add a header_filter as a parameter to the widget that is in the row_content.
By adding the header_filter parameter to a dataframe that does not have the same column types as the 'global' widget the content is not displayed.

Here is a minimal example:
(The first three lines are for reference, the problem is in the fourth line of the widget.)

import pandas as pd
import panel as pn
import numpy as np
import datetime as dt
pn.extension('tabulator')

df = pd.DataFrame(np.random.randint(0,100,size=(4, 4)), columns=list('ABCD'))
df2 = pd.DataFrame(np.random.randint(0,100,size=(4, 3)), columns=list('EFG'))
df3 = pd.DataFrame({
    'int': [1, 2, 3],
    'float': [3.14, 6.28, 9.42],
    'str': ['A', 'B', 'C'],
    'bool': [True, False, True],
    'date': [dt.date(2019, 1, 1), dt.date(2020, 1, 1), dt.date(2020, 1, 10)],
    'datetime': [dt.datetime(2019, 1, 1, 10), dt.datetime(2020, 1, 1, 12), dt.datetime(2020, 1, 10, 13)]
}, index=[1, 2, 3])

tab1 = pn.widgets.Tabulator(df, header_filters=True)
tab2 = pn.widgets.Tabulator(df2, header_filters=True)
tab3 = pn.widgets.Tabulator(df3)
tab4 = pn.widgets.Tabulator(df3, header_filters=True)

content_fn = lambda row: tab1 if row.name == 0 else (tab2 if row.name == 1 else (tab3 if row.name == 2 else tab4))

tabulator = pn.widgets.Tabulator(
            df, layout='fit_columns',
            sizing_mode='stretch_width',
            row_content=content_fn, embed_content=True, expanded=[0,1,2,3])

tabulator

screen_tabulator

The problem is visible in the console of my browser:

console_tabulator

@maximlt maximlt added the component: tabulator Related to the Tabulator widget label Jun 9, 2022
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
Projects
None yet
Development

No branches or pull requests

2 participants