Skip to content

Feat/Fix : Dataframe element fix and improvements#2845

Open
Allaoua9 wants to merge 6 commits intoChainlit:mainfrom
Allaoua9:feat/improved-dataframe
Open

Feat/Fix : Dataframe element fix and improvements#2845
Allaoua9 wants to merge 6 commits intoChainlit:mainfrom
Allaoua9:feat/improved-dataframe

Conversation

@Allaoua9
Copy link
Copy Markdown
Contributor

@Allaoua9 Allaoua9 commented Mar 16, 2026

This PR was implemented in collaboration with @tonca, many thanks to him !

  • Fixed issue with horizontal overflow in the pagination footer
  • Improved the Dataframe element by adding filters, sorting, column selection and ability to select the number of lines to display
  • New features are optional and disabled by default
Capture d'écran 2026-03-16 155342 Capture d'écran 2026-03-16 155415 Capture d'écran 2026-03-16 155421

Summary by cubic

Adds per-column filters, a column visibility menu, a page-size selector, expandable row details, and a clear-filters action to the Dataframe element for easier exploration. Also fixes horizontal overflow in the pagination footer and guards against None data on the backend.

  • New Features

    • Per-column filters and sorting in headers.
    • Column visibility dropdown with select/deselect all; controllable from Python via Dataframe(show_column_visibility=..., show_column_filters=...) and exposed as showColumnVisibility/showColumnFilters in @chainlit/react-client.
    • Page size selector (5/10/20/50) and a compact rows count indicator.
    • Expandable rows with a full details view on click.
    • Clear filters button and a localized “no results” state, with new i18n strings for the Dataframe UI in all locales.
  • Bug Fixes

    • Fixed horizontal overflow in the pagination footer.
    • Backend: handle data=None in Dataframe.__post_init__ to avoid errors when no data is provided.

Written for commit dcd54e6. Summary will update on new commits.

* Improved the Dataframe element by adding filters, sorting, column selection and ablity to select the number of lines to display
@dosubot dosubot bot added size:XL This PR changes 500-999 lines, ignoring generated files. enhancement New feature or request frontend Pertains to the frontend. translation Translation or localisation of strings. labels Mar 16, 2026
Copy link
Copy Markdown
Contributor

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

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

5 issues found across 25 files

Prompt for AI agents (unresolved issues)

Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.


<file name="frontend/src/components/Elements/Dataframe.tsx">

<violation number="1" location="frontend/src/components/Elements/Dataframe.tsx:78">
P2: Column filter always stores text input, but numeric columns use different filter semantics in TanStack, causing incorrect filtering for number fields.</violation>

<violation number="2" location="frontend/src/components/Elements/Dataframe.tsx:324">
P2: Expanded row details ignore column visibility and reveal hidden column data.</violation>
</file>

<file name="backend/chainlit/translations/zh-TW.json">

<violation number="1" location="backend/chainlit/translations/zh-TW.json:264">
P3: `zh-TW` translation uses a Simplified character in `filterPlaceholder`, causing mixed-script UI text.</violation>
</file>

<file name="backend/chainlit/element.py">

<violation number="1" location="backend/chainlit/element.py:450">
P2: Dataframe now serializes new flags, but Element.from_dict() still lacks a dataframe case and will rebuild these elements as File, losing dataframe type/options when rehydrating from dicts.</violation>
</file>

<file name="backend/chainlit/translations/kn.json">

<violation number="1" location="backend/chainlit/translations/kn.json:261">
P3: The new Kannada translation for `deselectAll` contains a Telugu character (U+0C15) in the middle of the word, resulting in mixed-script, potentially unreadable UI text for kn users.</violation>
</file>

Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.

Allaoua9 and others added 4 commits March 16, 2026 17:12
Co-authored-by: cubic-dev-ai[bot] <191113872+cubic-dev-ai[bot]@users.noreply.github.com>
Co-authored-by: cubic-dev-ai[bot] <191113872+cubic-dev-ai[bot]@users.noreply.github.com>
Copy link
Copy Markdown
Contributor

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

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

1 issue found across 4 files (changes from recent commits).

Prompt for AI agents (unresolved issues)

Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.


<file name="backend/chainlit/element.py">

<violation number="1" location="backend/chainlit/element.py:185">
P1: `Element.from_dict()` constructs `Dataframe` without `data`, causing runtime `TypeError` during dataframe deserialization.</violation>
</file>

Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.

Copy link
Copy Markdown
Contributor

@hayescode hayescode left a comment

Choose a reason for hiding this comment

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

Thanks @Allaoua9. I like the dataframe improvements, but I can't approve it yet because the frontend defaults currently make the new controls effectively opt-out for payloads that omit the new fields. Please align the frontend defaults with the documented/backend false default so older dataframe payloads remain backward-compatible.


const _DataframeElement = ({
data,
showColumnVisibility = true,
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This default is the opposite of the backend/public contract added in this PR. IDataframeElement.showColumnVisibility / showColumnFilters are optional and documented as defaulting to false, but older or persisted dataframe payloads that omit these fields will now render both controls enabled because the frontend falls back to true. Can we make the frontend default align with the contract so absent fields stay opt-in?

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

Labels

enhancement New feature or request frontend Pertains to the frontend. size:XL This PR changes 500-999 lines, ignoring generated files. translation Translation or localisation of strings.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants