Skip to content

feat: Add column_order parameter to Tabulator widget#8434

Open
SuMayaBee wants to merge 5 commits intoholoviz:mainfrom
SuMayaBee:tabulator-column-order
Open

feat: Add column_order parameter to Tabulator widget#8434
SuMayaBee wants to merge 5 commits intoholoviz:mainfrom
SuMayaBee:tabulator-column-order

Conversation

@SuMayaBee
Copy link
Copy Markdown
Contributor

@SuMayaBee SuMayaBee commented Feb 24, 2026

Description

Adds column_order parameter to Tabulator widget to control column visibility and display order, equivalent to Streamlit's data_editor column_order parameter.

Changes

  • Add column_order parameter to filter and reorder displayed columns
  • Override _get_columns() to implement column filtering/ordering logic
  • Add comprehensive tests

Example

import pandas as pd
import panel as pn

df = pd.DataFrame({
    'col1': [1, 2, 3],
    'col2': [4, 5, 6],
    'col3': [7, 8, 9],
    'col4': [10, 11, 12],
})

# Show only col3 and col1, in that order
tab = pn.widgets.Tabulator(df, column_order=['col3', 'col1'])

The table will display columns in the order: index, col3, col1 (col2 and col4 are hidden).

Behavior

  • column_order=None (default): All columns shown in original order
  • column_order=[...]: Only listed columns shown in specified order
  • Index columns always appear first and cannot be reordered/hidden
  • Invalid column names are silently ignored

Fixes #8431

AI Disclosure: Claude Haiku 4.5 was used for exploring the codebase during the development of this PR.

@codecov
Copy link
Copy Markdown

codecov bot commented Feb 27, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 86.00%. Comparing base (49872f3) to head (6dba194).
⚠️ Report is 48 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #8434      +/-   ##
==========================================
- Coverage   86.12%   86.00%   -0.13%     
==========================================
  Files         349      349              
  Lines       54971    55013      +42     
==========================================
- Hits        47343    47313      -30     
- Misses       7628     7700      +72     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@SuMayaBee
Copy link
Copy Markdown
Contributor Author

Hi @philippjfr, I’ve added a small visual demo to verify the new column_order behavior.

pn.widgets.Tabulator(df)                              # default: all columns in original order
pn.widgets.Tabulator(df, column_order=["col3", "col1"])  # only col3 and col1 shown, in that order; others hidden
Screenshot from 2026-02-27 12-49-58

In the attached screenshot, both sides use the same input DataFrame:

  • Left: default Tabulator (column_order=None) → all columns are shown in the original order.
  • Right: column_order=['col3', 'col1'] → only col3 and col1 are displayed, in that order, with the index preserved and col2/col4 hidden.

This matches the behavior described in #8431 and Streamlit’s data_editor.column_order parameter.
Whenever you have time, I’d really appreciate a review or any feedback on the approach. Thanks!

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.

Allow define the visibility and order of columns in Tabulator

1 participant