holoviz / panel

Panel: The powerful data exploration & web app framework for Python
https://panel.holoviz.org
BSD 3-Clause "New" or "Revised" License
4.79k stars 519 forks source link

Tabulator with row_content : not toggling (collapse/expand) properly #7361

Closed jleonard99 closed 1 month ago

jleonard99 commented 1 month ago

ALL software version info

Panel:  1.5.1
Python: 3.12.6
Quarto: 1.5.57
Jupyter: 5.7.2

Description of expected behavior and the observed behavior

Desired behaviors

Observed behaviors

Here is a larger example of the issue in the wild. Here is a tabulator with row_content:

I’d like the row_content to be collapsed on loading. An older version of panel had this default. Since upgrading the code my row_content is expanded on loading.

Complete, minimal, self-contained example code that reproduces the issue

import pandas as pd
import panel as pn

pn.extension('tabulator')

# sample dataframe
data = {'name': ['Alice', 'Bob', 'Charlie'],
        'Value1': [10, 20, 30],
        'Value2': [3, 2, 5],
        }
df = pd.DataFrame(data)

# function to return row contents
def content_fn( row ):
    return pn.pane.Markdown(
        f'# Row contents\n name: {row["name"]}',
        sizing_mode='stretch_width'
    )

# tabulator object with row_contents
sample_table = pn.widgets.Tabulator(
    df, height=350,
    layout='fit_columns',
    sizing_mode='stretch_width',
    row_content=content_fn,
    embed_content=True,
    expanded = []
)

sample_table
holovizbot commented 1 month ago

This issue has been mentioned on HoloViz Discourse. There might be relevant details there:

https://discourse.holoviz.org/t/tabulator-with-collapsed-row-content-by-default/8301/6