Skip to content

Feat/Fix : Dataframe element fix and improvements#2845

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

Feat/Fix : Dataframe element fix and improvements#2845
Allaoua9 wants to merge 7 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

Upgrades the Dataframe element with per-column filters, column visibility, page size control, expandable rows, and a clear-filters action for easier exploration. Also fixes pagination footer overflow, aligns frontend/backend defaults for new options, and safely handles None data.

  • 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 (off by default).
    • Page size selector (5/10/20/50) and a compact rows count indicator.
    • Expandable rows with a full details view on click.
    • New i18n strings for the Dataframe UI across locales, including a localized “no results” state.
  • Bug Fixes

    • Fixed horizontal overflow in the pagination footer.
    • Backend: handle data=None in Dataframe.__post_init__ and add (de)serialization for the new visibility/filter flags to keep frontend and backend in sync.

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

@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.

Comment thread frontend/src/components/Elements/Dataframe.tsx Outdated
Comment thread frontend/src/components/Elements/Dataframe.tsx
Comment thread backend/chainlit/element.py
Comment thread backend/chainlit/translations/zh-TW.json Outdated
Comment thread backend/chainlit/translations/kn.json Outdated
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.

Comment thread backend/chainlit/element.py
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?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Hi @hayescode
Thanks for the review !

I have fixed the issue, now the frontend is aligned with the backend.

Benchikh, Allaoua and others added 7 commits May 4, 2026 11:05
* Improved the Dataframe element by adding filters, sorting, column selection and ablity to select the number of lines to display
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>
@Allaoua9 Allaoua9 force-pushed the feat/improved-dataframe branch from dcd54e6 to c583629 Compare May 4, 2026 09:18
@dosubot dosubot Bot added size:L This PR changes 100-499 lines, ignoring generated files. and removed size:XL This PR changes 500-999 lines, ignoring generated files. labels May 4, 2026
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:L This PR changes 100-499 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