table icon indicating copy to clipboard operation
table copied to clipboard

Drag n' drop column rearranging

Open rajaraodv opened this issue 9 years ago • 10 comments

Please add support for drag-drop and rearrange columns

rajaraodv avatar Apr 10 '17 17:04 rajaraodv

This is also a feature that could have a lot of collision with internal table state, and would likely be more involved that it appears on the surface. We'll put a pin in this one, as it is very interested and expected.

How would we handle touch support? Would we handle the state internally or simply enforce this as a controlled input? Would the column dragging be animated? How much bloat does this add to the library that could otherwise be achieved as a plugin or user-implemented feature (with help from the wiki)?

tannerlinsley avatar Apr 10 '17 19:04 tannerlinsley

Thanks for considering this feature.

How would we handle touch support? I believe that people who want this kind of library also want all of the 'spreadsheet' features. And 99% of the user who use this are on laptops and may be 1% on tablets. So if any of the mobile features (especially sub-features like drag-n-drop) should be fine if it works just on full browser.

How much bloat does this add to the library that could otherwise be achieved as a plugin or user-implemented feature (with help from the wiki)?

Performance is the key. I know libraries charging $1000 - $2000 because of all the features and performance. My suggestion is to build all these extra but necessary features as plugins or HOC.

rajaraodv avatar Apr 10 '17 19:04 rajaraodv

That's the spirit!

I agree. I personally was using ag-grid when I decided to build react-table, and it is nice to have those features.

I think as long as we develop them as HOC's and keep them close under the wing of react-table (compatibility, updates, semver), then we should be okay. The smaller we can keep these addons, the better :)

tannerlinsley avatar Apr 10 '17 20:04 tannerlinsley

As addons they should be independent of the core. HOCs are almost certainly the way forwards.

pwhipp avatar Apr 10 '17 20:04 pwhipp

Lets shoot for an hoc or wiki entry to get the ball rolling

tannerlinsley avatar Apr 17 '17 04:04 tannerlinsley

Hi

Take a look at this https://codesandbox.io/s/5vxlnjrw1n

Jucesr avatar Feb 12 '18 00:02 Jucesr

Any updates on this being a feature in react-table?

nooruddin avatar Jun 15 '18 21:06 nooruddin

@Jucesr , awesome work on the drag/drop, I am using the same in one of my project, but the unable to drag and drop in firefox, can you please help out?

bishwenduk029 avatar Aug 15 '18 07:08 bishwenduk029

Hi @bishwenduk029 , I ran into the same issue and I solved it by adding e.dataTransfer.setData("Text", i); to onDragStart. Apperently this is necessary in Firefox. Hope this helps :) (Though you probably have already solved it, but for others)

Zukye avatar Mar 22 '19 09:03 Zukye

I came up with a very simple solution to this. Here's my gist

https://gist.github.com/anazard/aaf842c47506ad5d87842e7c82196482

anacampesan avatar Mar 30 '20 19:03 anacampesan