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

Perspective pane collapses rows when updating data #7554

Open
rob-tay opened this issue Dec 16, 2024 · 0 comments
Open

Perspective pane collapses rows when updating data #7554

rob-tay opened this issue Dec 16, 2024 · 0 comments
Milestone

Comments

@rob-tay
Copy link

rob-tay commented Dec 16, 2024

ALL software version info

panel 1.5.4
Windows, MacOS, Chrome, Edge

Description of expected behavior and the observed behavior

There appears to be a bug with the perspective pane automatically collapsing the hierarchy when the underlying data object is updated - this only seems to happen after clicking to expand or collapse a row. This makes it pretty annoying and difficult to use when a periodic callback is used to refresh the data.

I'd expect the depth of the hierarchy to be retained to whatever is currently visible.

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

import pandas as pd
import numpy as np
import panel as pn
pn.extension('perspective')

def get_data(n=100):
    return pd.DataFrame({'x': np.random.choice(['A', 'B'], size=n), 'y': np.random.choice(['C', 'D'], size=n), 'z': np.random.normal(size=n)})

table = pn.pane.Perspective(get_data(), group_by=['x', 'y'], sizing_mode='stretch_both')

def update_data():
    table.object = get_data()

pn.state.add_periodic_callback(update_data)

pn.Row(table, sizing_mode='stretch_width', height=1000)

Image

After collapsing "A", the rest of the levels will collapse and will get stuck

Image

@philippjfr philippjfr added this to the v1.6.0 milestone Jan 20, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants