material-table icon indicating copy to clipboard operation
material-table copied to clipboard

Prevent column reordering

Open 6d70 opened this issue 7 years ago • 8 comments

Any way to prevent the user from moving the columns around?

6d70 avatar Jun 24 '19 17:06 6d70

I checked the code the other day, and there doesn't seem to be one. It should be fairly simple to implement.

There is a react-beautiful-dnd component that is inserted into each header cell. With an additional parameter in props.options, this could be changed to use a simple div

gianlucamateo avatar Jun 25 '19 08:06 gianlucamateo

Thanks, I will take a look later and create a PR if there is no objections to adding such a feature.

6d70 avatar Jun 25 '19 09:06 6d70

I thought being able to drag the columns was a feature. I find it cool.

iamwilson avatar Jun 25 '19 15:06 iamwilson

I also like the feature. But I think it can get in the way of some functionality and custom components. IMO, it would therefore be appropriate to make it optional, or ideally opt-out.

In my use case I am rendering a second row in the header with controls that control some column properties, and am using a fixed layout with computed widths. Moving columns around in that scenario is not pretty.

gianlucamateo avatar Jun 25 '19 15:06 gianlucamateo

@xiaomaini Please do implement this as it is not always desirable to have some columns be draggable.

mviens avatar Jun 26 '19 19:06 mviens

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. You can reopen it if it required.

stale[bot] avatar Jun 15 '20 17:06 stale[bot]

any updates to this would be great as its a feature we're looking for as well

jason-zeiler-bayer avatar Aug 15 '23 20:08 jason-zeiler-bayer

any updates to this would be great as its a feature we're looking for as well

See #779

6d70 avatar Aug 16 '23 06:08 6d70