Skip to content

feat(table): add conditional formatting support for categorical columns#37756

Open
sharmavikas18 wants to merge 3 commits into
apache:masterfrom
sharmavikas18:fix/conditional-formatting-categorical
Open

feat(table): add conditional formatting support for categorical columns#37756
sharmavikas18 wants to merge 3 commits into
apache:masterfrom
sharmavikas18:fix/conditional-formatting-categorical

Conversation

@sharmavikas18
Copy link
Copy Markdown

Fixes #37678

SUMMARY

This PR enables conditional formatting for categorical columns (String and Boolean)
in both the Standard Table plugin and the AG Grid Table plugin.

Previously, categorical columns were blocked by control panel filtering logic,
even though the conditional formatting UI already supported categorical operators.

This change removes those restrictions and allows categorical columns to be used
in conditional formatting rules.

Changes made:

Standard Table plugin
File:
superset-frontend/plugins/plugin-chart-table/src/controlPanel.tsx

  • Removed the !hasTimeComparison restriction that prevented String and Boolean
    columns from appearing in the conditional formatting selector.
  • Updated description text from:
    "Apply conditional color formatting to numeric columns"
    to:
    "Apply conditional color formatting to columns".

AG Grid Table plugin
File:
superset-frontend/plugins/plugin-chart-ag-grid-table/src/controlPanel.tsx

  • Updated filtering logic to include:
    • GenericDataType.String
    • GenericDataType.Boolean
      in addition to GenericDataType.Numeric.
  • Updated description/label text for consistency.

User impact:

  • String columns now support operators like:
    equals, begins with, ends with, contains, not contains
  • Boolean columns now support operators like:
    is true, is false, is null, is not null

Technical notes:

  • Reused existing GenericDataType enum.
  • Minimal, targeted diff without structural refactoring.
  • Code formatted using Prettier.

All relevant tests passed (254 tests).

BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF

Not applicable.

TESTING INSTRUCTIONS

  1. Run Superset locally.
  2. Create or open a dataset containing:
    • String columns
    • Boolean columns
  3. Create a Table visualization (Standard Table or AG Grid Table).
  4. Open "Conditional Formatting".
  5. Verify that:
    • String columns appear in the column selector
    • Boolean columns appear in the column selector
  6. Add formatting rules using categorical operators.
  7. Confirm formatting applies correctly in the rendered table.

ADDITIONAL INFORMATION

  • Has associated issue: Fixes Custom Conditional Formatting for Categorical Columns #37678
  • Required feature flags:
  • Changes UI
  • Includes DB Migration (follow approval process in SIP-59)
    • Migration is atomic, supports rollback & is backwards-compatible
    • Confirm DB migration upgrade and downgrade tested
    • Runtime estimates and downtime expectations provided
  • Introduces new feature or API
  • Removes existing feature or API

@bito-code-review
Copy link
Copy Markdown
Contributor

bito-code-review Bot commented Feb 6, 2026

Code Review Agent Run #b05187

Actionable Suggestions - 0
Review Details
  • Files reviewed - 2 · Commit Range: a9233f4..a9233f4
    • superset-frontend/plugins/plugin-chart-ag-grid-table/src/controlPanel.tsx
    • superset-frontend/plugins/plugin-chart-table/src/controlPanel.tsx
  • Files skipped - 0
  • Tools
    • Whispers (Secret Scanner) - ✔︎ Successful
    • Detect-secrets (Secret Scanner) - ✔︎ Successful

Bito Usage Guide

Commands

Type the following command in the pull request comment and save the comment.

  • /review - Manually triggers a full AI review.

  • /pause - Pauses automatic reviews on this pull request.

  • /resume - Resumes automatic reviews.

  • /resolve - Marks all Bito-posted review comments as resolved.

  • /abort - Cancels all in-progress reviews.

Refer to the documentation for additional commands.

Configuration

This repository uses Superset You can customize the agent settings here or contact your Bito workspace admin at evan@preset.io.

Documentation & Help

AI Code Review powered by Bito Logo

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Enables conditional formatting for categorical (String/Boolean) columns in the Standard Table and AG Grid Table plugins by broadening the conditional-formatting column filtering logic and updating control descriptions.

Changes:

  • Updated conditional formatting control description to be type-agnostic (“…to columns”) in both table plugins.
  • Expanded conditional-formatting column eligibility to include GenericDataType.String and GenericDataType.Boolean (previously numeric-only / time-compare gated).

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
superset-frontend/plugins/plugin-chart-table/src/controlPanel.tsx Broadens eligible conditional-formatting columns and updates help text.
superset-frontend/plugins/plugin-chart-ag-grid-table/src/controlPanel.tsx Broadens eligible conditional-formatting columns and updates help text.
Comments suppressed due to low confidence (2)

superset-frontend/plugins/plugin-chart-table/src/controlPanel.tsx:820

  • When hasTimeComparison is true, columnOptions is derived via processComparisonColumns(numericColumns, ...). Now that numericColumns includes String/Boolean, this path will (a) generate Main/#/△/% options for categorical columns that do not exist in transformProps, (b) drop the original categorical columns from the selector, and (c) lose dataType, causing the conditional-formatting UI to fall back to numeric operators. Consider splitting numeric vs categorical options: generate comparison options only for numeric columns (with dataType: Numeric), and include String/Boolean columns as-is so they remain selectable during time comparison.
                const numericColumns =
                  Array.isArray(colnames) && Array.isArray(coltypes)
                    ? colnames.reduce((acc, colname, index) => {
                        if (
                          coltypes[index] === GenericDataType.Numeric ||
                          coltypes[index] === GenericDataType.String ||
                          coltypes[index] === GenericDataType.Boolean
                        ) {
                          acc.push({
                            value: colname,
                            label: Array.isArray(verboseMap)
                              ? colname
                              : (verboseMap[colname] ?? colname),
                            dataType: coltypes[index],
                          });
                        }
                        return acc;
                      }, [])
                    : [];
                const columnOptions = hasTimeComparison
                  ? processComparisonColumns(
                      numericColumns || [],
                      ensureIsArray(timeCompareValue)[0]?.toString() || '',
                    )
                  : numericColumns;

superset-frontend/plugins/plugin-chart-ag-grid-table/src/controlPanel.tsx:739

  • In time comparison mode, processComparisonColumns(numericColumns, ...) will now receive String/Boolean columns too. That helper generates Main/#/△/% variants and omits dataType, which means categorical columns either disappear (originals not included) or show invalid comparison-prefixed options with numeric operators. Update the time-comparison branch to only expand numeric columns into comparison options (with dataType: Numeric) and keep categorical columns unchanged in columnOptions.
                const numericColumns =
                  Array.isArray(colnames) && Array.isArray(coltypes)
                    ? colnames
                        .filter(
                          (colname: string, index: number) =>
                            coltypes[index] === GenericDataType.Numeric ||
                            coltypes[index] === GenericDataType.String ||
                            coltypes[index] === GenericDataType.Boolean,
                        )
                        .map((colname: string) => ({
                          value: colname,
                          label: Array.isArray(verboseMap)
                            ? colname
                            : (verboseMap[colname] ?? colname),
                          dataType:
                            colnames && coltypes[colnames?.indexOf(colname)],
                        }))
                    : [];
                const columnOptions = hasTimeComparison
                  ? processComparisonColumns(
                      numericColumns || [],
                      ensureIsArray(timeCompareValue)[0]?.toString() || '',
                    )
                  : numericColumns;

Comment thread superset-frontend/plugins/plugin-chart-table/src/controlPanel.tsx Outdated
Comment thread superset-frontend/plugins/plugin-chart-ag-grid-table/src/controlPanel.tsx Outdated
Comment thread superset-frontend/plugins/plugin-chart-table/src/controlPanel.tsx
@netlify
Copy link
Copy Markdown

netlify Bot commented Feb 8, 2026

Deploy Preview for superset-docs-preview ready!

Name Link
🔨 Latest commit 14251b9
🔍 Latest deploy log https://app.netlify.com/projects/superset-docs-preview/deploys/6988603c43e2bb00086759b6
😎 Deploy Preview https://deploy-preview-37756--superset-docs-preview.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@bito-code-review
Copy link
Copy Markdown
Contributor

bito-code-review Bot commented Feb 8, 2026

Code Review Agent Run #446e9a

Actionable Suggestions - 0
Review Details
  • Files reviewed - 2 · Commit Range: a9233f4..14251b9
    • superset-frontend/plugins/plugin-chart-ag-grid-table/src/controlPanel.tsx
    • superset-frontend/plugins/plugin-chart-table/src/controlPanel.tsx
  • Files skipped - 0
  • Tools
    • Whispers (Secret Scanner) - ✔︎ Successful
    • Detect-secrets (Secret Scanner) - ✔︎ Successful

Bito Usage Guide

Commands

Type the following command in the pull request comment and save the comment.

  • /review - Manually triggers a full AI review.

  • /pause - Pauses automatic reviews on this pull request.

  • /resume - Resumes automatic reviews.

  • /resolve - Marks all Bito-posted review comments as resolved.

  • /abort - Cancels all in-progress reviews.

Refer to the documentation for additional commands.

Configuration

This repository uses Superset You can customize the agent settings here or contact your Bito workspace admin at evan@preset.io.

Documentation & Help

AI Code Review powered by Bito Logo

@SBIN2010
Copy link
Copy Markdown
Contributor

SBIN2010 commented Feb 8, 2026

Superset uses Git pre-commit hooks courtesy of pre-commit. To install run the following:

pip3 install -r requirements/development.txt
pre-commit install
A series of checks will now run when you make a git commit.

Alternatively it is possible to run pre-commit by running pre-commit manually:

pre-commit run --all-files

rusackas pushed a commit that referenced this pull request Apr 17, 2026
- theming.mdx: document ECharts array property overrides (PR #37965) —
  array values like color palettes are fully supported and replaced entirely
  (not merged); adds Array Property Overrides section with color palette example
- configuring-superset.mdx: document PKCE support for database OAuth2
  (PR #37067) — add PKCE section under Custom OAuth2 with code_challenge_method
  config and when to use it
- cache.mdx: document ETag support for thumbnail/screenshot endpoints
  (PR #37663) — conditional GET with If-None-Match to avoid downloading
  unchanged images
- exploring-data.mdx: document SQL Lab UX improvements (PRs #37298, #37694,
  #37756) — treeview table browser, Ctrl+F find widget, resizable panels;
  also adds time range natural language expressions section (PR #37098)
- creating-your-first-dashboard.mdx: document Table chart features — boolean
  and categorical conditional formatting (PRs #36338, #37756), gradient toggle
  (PR #36280), HTML cell rendering with security note (PR #37685), column
  header tooltips from dataset descriptions (PR #37179), Display Controls
  modal in dashboard view (PR #36062)
- databases.json: update StarRocks supports_catalog and supports_dynamic_catalog
  to true — the engine spec (PR #37026) already implemented full catalog support
  with get_catalog_names(), get_default_catalog(), and SHOW CATALOGS; the
  committed JSON was stale and did not reflect this

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@harrystaley
Copy link
Copy Markdown

This feature needs to be included. Please add conditional formatting to categorical or boolean columns such as strings, etc.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Custom Conditional Formatting for Categorical Columns

4 participants