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

Add support for rendering panels inside Tabulator rows #2762

Merged
merged 10 commits into from
Oct 12, 2021

Conversation

philippjfr
Copy link
Member

@philippjfr philippjfr commented Sep 21, 2021

Adds two parameters to Tabulator to support adding additional content inside a Tabulator row, which acts like an accordion.

  • expanded: The currrently expanded rows
  • row_content: A function which is given a DataFrame row as input and should output a Panel object
  • embed_content: Whether to embed all the contents or to dynamically fetch them when the row is expanded (default)

Implements #2761

def row_detail(row):
    return row.to_frame()

pn.widgets.Tabulator(
    value=pd.DataFrame([(0, 1), (1, 2)]),
    row_content=row_detail, sizing_mode='stretch_height'
)

tabulator_nested

world = geopandas.read_file(geopandas.datasets.get_path('naturalearth_lowres'))
pn.widgets.Tabulator(world, row_content=lambda row: geopandas.GeoDataFrame(row.to_frame().T).hvplot())

Screen Shot 2021-09-21 at 1 17 05 PM

  • Add tests
  • Update Tabulator reference gallery
  • Add gallery example
  • Ensure children are cleaned up

@MarcSkovMadsen
Copy link
Collaborator

This is exactly the functionality I've been using via Angular. Looks great.

@codecov
Copy link

codecov bot commented Oct 12, 2021

Codecov Report

Merging #2762 (ed9a9cc) into master (1bd5987) will increase coverage by 0.06%.
The diff coverage is 96.22%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #2762      +/-   ##
==========================================
+ Coverage   82.97%   83.03%   +0.06%     
==========================================
  Files         188      188              
  Lines       24162    24264     +102     
==========================================
+ Hits        20048    20148     +100     
- Misses       4114     4116       +2     
Impacted Files Coverage Δ
panel/widgets/tables.py 86.55% <93.75%> (+1.05%) ⬆️
panel/models/tabulator.py 94.44% <100.00%> (+0.15%) ⬆️
panel/tests/widgets/test_tables.py 99.39% <100.00%> (+0.05%) ⬆️
panel/tests/pane/test_plotly.py 98.15% <0.00%> (-0.62%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 1bd5987...ed9a9cc. Read the comment docs.

@philippjfr philippjfr merged commit 6e1109f into master Oct 12, 2021
@philippjfr philippjfr deleted the nested_tabulator branch October 12, 2021 17:07
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

Successfully merging this pull request may close these issues.

2 participants