React-data-grid: [Idea] Drag column to reorder

Created on 13 Nov 2015  路  16Comments  路  Source: adazzle/react-data-grid

Description

Implement column header dragging to reorder a column

Requirements

enhancement help wanted

Most helpful comment

+1

All 16 comments

+1

+1

This was released in 1.0.37.

An example can be found in here.

@diogofcunha - Row reordering was released, but was _column_ reordering?

Just wanted to chime in on this, any update on column reordering?

Still nothing here? Would really like to see this.

Hello, since we need this to work in the company I work for I tried to implement this feature (I used draggable rows as an inspiration), here is the pull request https://github.com/adazzle/react-data-grid/pull/702

I hope it will get pass through the code review, but I know they might be a problem with my tests as it were my first tests I was writing :D.

You can clone my fork of react data grid and try it, it is example 24 - Draggable header cell.

Thank you

Here is little clip, where I show you how it works, the second part with popup is not in this pull request, but it is easy to implement it on your own.
https://drive.google.com/file/d/0B04DA-ziLi_GSEJLUnBkMVU3QVU/view

Hi. Nice lib! But I'm getting errors with the React.createClass being deprecated. Is there any way I can use this with ES6 React?

hey @JimTheMan -- that's an issue to do with React versions; you can track that discussion here https://github.com/adazzle/react-data-grid/issues/744

Thanks. Unfortunately, this feature uses React dnd and provides no way of passing in an "HTML5Backend". Is there not a way to use this grid in an app that separately uses React dnd?

Hello @JimTheMan if I am understanding your question correctly you would like to use grid without React DnD context, right? What you can do to remove backend for ReactDnD is to copy and paste this two files in your project (DraggableHeaderCell and DraggableContainer) https://github.com/adazzle/react-data-grid/tree/master/packages/react-data-grid-addons/src/draggable-header, then remove DragAndDrop Context from this file https://github.com/adazzle/react-data-grid/blob/master/packages/react-data-grid-addons/src/draggable-header/DraggableContainer.js#L29 (in case you are already using React DnD in your app), then wrap your data grid in DraggableContainer and then it should work as expected. I know it is not the best way how to do it tho :/ Hope it helps

@martinnov92 Interesting, but what do you mean by "copy and paste these files into your project"? I can put them anywhere in my project?

@JimTheMan you can put them anywhere as long as you can import them :D I put them in the folder where I got my grid wrapped and tweaked so it suits my needs and there I import the DraggableContainer, hope it makes sense.

@martinnov92 Thanks. Hackish, but it worked! :)

Hey guys, kinda old (I know) but the company I work for it evaluating table libraries and draggable column is number 2 on our list of things to have. Has there been any updates?

Was this page helpful?
0 / 5 - 0 ratings