mui-x icon indicating copy to clipboard operation
mui-x copied to clipboard

[DataGrid] Implement Column pinning

Open oliviertassinari opened this issue 6 years ago • 23 comments

Benchmark

  • https://ant.design/components/table/#components-table-demo-fixed-columns
Screenshot 2023-10-13 at 23 19 55
  • https://devexpress.github.io/devextreme-reactive/react/grid/docs/guides/fixed-columns/
  • https://ag-grid.com/javascript-grid-pinning/
  • https://www.telerik.com/kendo-react-ui/components/grid/columns/locked/
  • https://demos.telerik.com/kendo-ui/grid/frozen-columns
  • http://schrodinger.github.io/fixed-data-table-2/fixed-right-columns.html
  • https://ej2.syncfusion.com/react/demos/#/material/grid/frozen-rows
  • http://tabulator.info/docs/4.5/layout#frozen
  • https://www.jqwidgets.com/react/react-grid/#https://www.jqwidgets.com/react/react-grid/react-grid-pinnedfrozencolumns.htm
  • https://material-table.com/#/docs/features/fixed-columns, the issue: https://github.com/mbrn/material-table/issues/43

oliviertassinari avatar Aug 21 '20 13:08 oliviertassinari

We need to find a final name for the feature. There are a bunch of options: Sticky, Frozen, Locked, or Pinned. We are leaning to Pinning.

oliviertassinari avatar Sep 21 '20 12:09 oliviertassinari

@oliviertassinari This is cool. Two questions:

  1. Is the idea that it would be a user-triggered feature (user can pin interesting columns), a developer-configured feature or some combination of both?
  2. Are you planning to incorporate the ability to pin columns to the right (e.g.- AntD's fixed="right")?

If there's some other place I could have found this info myself, please let me know. This feature would definitely be useful for us.

caitecoll avatar Sep 24 '20 16:09 caitecoll

@caitecoll 1. Which one do you need? We will start with a developer-configuration as it's simpler. 2. I think that left and right pinning should be supported.

oliviertassinari avatar Sep 26 '20 08:09 oliviertassinari

Thanks, that sounds great. Developer configuration and right pinning are the two things we need.

caitecoll avatar Sep 28 '20 14:09 caitecoll

@oliviertassinari Great feature. I've implemented a similar feature in a private grid. The challenge was to ensure keyboard navigation flows naturally when a column is moved out of order to either left or right region. The other challenge is depending on how the underlying html is rendered you may or may not have the ability to support rows with variable heights (height="auto")

Another improvement is to show soft shadow dynamically on either of the pinned columns depending on the horizontal scroll position.

simoami avatar Sep 30 '20 02:09 simoami

For our use case it's critical that we can pin the checkbox which currently is implemented as a pseudo-column via the checkboxSelection prop. Do you plan to add another prop like pinnedCheckbox?

ak-mid avatar Dec 14 '20 14:12 ak-mid

@ak-mid Do you have a visual illustration of what you mean by "pinning the checkbox"?

oliviertassinari avatar Dec 14 '20 15:12 oliviertassinari

@oliviertassinari Sorry, I have no visual illustration at hand right now :( The use case is that the checkbox on the left to select a row is still available (pinned, sticky) if a user scrolls horizontally inside of the grid. It's actually like pinning the first row of the grid which includes a checkbox.

ak-mid avatar Dec 14 '20 15:12 ak-mid

We really need this "Sticky" column functionality for our application. Do we have an idea of when this will be available?

abrookie avatar Apr 21 '21 15:04 abrookie

Would really love to see this feature soon. Is there any ETA?

tierneynr avatar May 11 '21 21:05 tierneynr

Is this something that will prevent the checkbox from being draggable? In DataGrid it seems to be stuck in position, but in XGrid the checkbox column can be dragged and moved around. You can see it here:

https://codesandbox.io/s/gttt1?file=/demo.tsx

The checkbox column is draggable ^

y2b1 avatar May 25 '21 18:05 y2b1

@y2b1 What's your expected outcome? (It makes me think about #1672).

oliviertassinari avatar May 25 '21 18:05 oliviertassinari

@oliviertassinari Is this available to work on? It seems like the most common requests are:

  • pinning columns to the left and right
  • being able to pin the checkbox "column"
  • doing this from the developer side only

I would love to contribute if possible.

tylerlinquata avatar Jun 08 '21 22:06 tylerlinquata

@tylerlinquata Note that we intend to license the feature as part of the Pro plan. If this is not a showstopper and you are willing to sign a Copyright Assignment Agreement then we could continue the discussion further :).

oliviertassinari avatar Jun 13 '21 21:06 oliviertassinari

@oliviertassinari I'm talking to my company about it, I'll update if they'd be willing to sign an agreement.

tylerlinquata avatar Jun 22 '21 23:06 tylerlinquata

Is it possible to release it a little faster - the ability to make a pin not programmatically, but only with a fix with an indication in props. example: fixedColumn Unfortunately, due to virtualization, I could not do it with styles.

Group 18

Neonin avatar Jun 23 '21 15:06 Neonin

Has anyone taken this feature up to complete?

rlmonger avatar Jul 03 '21 08:07 rlmonger

any progress ?

enlicayomer avatar Aug 05 '21 17:08 enlicayomer

This was on the Q3 2021 Jul - Sep roadmap. Any updates on timeline?

jessq avatar Oct 10 '21 21:10 jessq

We spent most of our Q3 adapting for the v5 version of the core and building strong internals to be future proof. The roadmap for Q4 / Q5 is currently being redacted. The column pinning will be part of Q4. Is needs #2673 (like most of our new features) but once this is ready, it should be an easy feature to build.

flaviendelangle avatar Oct 11 '21 07:10 flaviendelangle