Skip to content

Freeze right columns #1059

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

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open

Conversation

MMihran
Copy link

@MMihran MMihran commented Jun 22, 2025

This MR adds support for freezing columns on the right side.
It used draft MR #973 as a base, with major fixes and improvements:

  • Corrected column positioning calculations
  • Fixed hover states
  • Fixed scroll shadows
  • Added handling for column groupings

This addresses the right-side freeze column feature requested in multiple issues: #469, #522, #919, and #957.
The API remains backward compatible, following the proposal here by @jassmith:

interface DataEditorProps {
    // ...
    freezeColumns: number | [left: number, right: number];
}

@MMihran MMihran force-pushed the freeze-right-columns branch from b898364 to 17d0bf2 Compare June 22, 2025 13:56
@MMihran MMihran force-pushed the freeze-right-columns branch from 17d0bf2 to f378e2e Compare June 22, 2025 14:08
@lukasmasuch lukasmasuch requested a review from Copilot June 24, 2025 23:15
Copy link
Contributor

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

This pull request adds support for freezing columns on the right side by extending the freezeColumns API to accept a tuple of [left, right] values and updating numerous grid‐rendering, selection and event-handling routines accordingly. Key changes include:

  • Computing and propagating distinct freezeLeftColumns and freezeRightColumns values throughout the grid code.
  • Updating rendering functions (headers, cells, grid lines, blitting) to properly account for right-side frozen columns.
  • Updating relevant tests and stories to validate the new right-freeze functionality.

Reviewed Changes

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

Show a summary per file
File Description
packages/source/src/use-collapsing-groups.ts Updated iteration over columns using freezeLeftColumns and freezeRightColumns for collapsing groups.
packages/core/test/* Added tests verifying freeze column behavior including both trailing (right-side) and left-side freezing.
packages/core/src/internal/... Updated grid rendering (scrolling, rings, header, cells, blit, etc.) and related utilities to support the new API.
packages/core/src/data-editor/data-editor.tsx Modified freezing calculations and rendering of freezeRegions to handle separate left/right freeze areas.
packages/core/src/docs/examples/freeze-columns.stories.tsx Updated story and controls to demonstrate the new freezeColumns prop structure.
Comments suppressed due to low confidence (3)

packages/core/src/internal/data-grid/render/data-grid-lib.ts:28

  • Consider adding an inline comment here explaining that freezeColumnsLeft and freezeColumnsRight are derived from the union type and used to determine which columns should remain sticky at the left and right sides respectively. This will help future maintainers understand the design rationale.
    const freezeColumnsRight = typeof freezeColumns === "number" ? 0 : freezeColumns[1];

packages/core/src/data-editor/data-editor.tsx:2499

  • The revised computation of freezeRegions now produces separate regions for the left and right frozen columns. Please ensure that all downstream consumers of freezeRegions (e.g. for event handling or redraw calculations) correctly support multiple freeze regions.
            const freezeLeftRegion =

packages/core/src/internal/data-grid/render/data-grid-render.blit.ts:128

  • The updated blitting calculation now subtracts both the left and right sticky widths. Please verify that this logic consistently covers all scrolling scenarios and minimizes redraws especially when either the left or right freeze areas are active.
        // blit X

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