glide-data-grid icon indicating copy to clipboard operation
glide-data-grid copied to clipboard

Customizable row/column reordering

Open pzcfg opened this issue 2 years ago • 4 comments

The current reordering support is very useful, but quite limiting in terms of customizability.

In its current state, draggability can only be controlled by defining onRowMoved and onColumnMoved, at which point any row/column can be dragged to any position, and there's no control over whether that's an allowed action other than to have it jump back when the dragging is complete.

Some API additions that would help are:

  • Whether the current row/column is allowed to be dragged
  • When dragging has started / is in progress (and index of which is being dragged)
  • Control which rows/columns it is allowed to be dropped over / next to
  • Customizable styling/drawing for the column being dragged

In a similar vein, some additional onColumnResized APIs would also be helpful, such as:

  • Whether the current column can be resized
  • Column resizing has started / is in progress
  • Minimum and maximum sizes for each column

pzcfg avatar Apr 15 '22 17:04 pzcfg

The column resize start/end events exist. I will add the ability to preventDefault on them. Then we can just do the same for rowMovedStart/End and would that be enough or do you also need to filter final positions not just start positions?

jassmith avatar Apr 15 '22 22:04 jassmith

Closing due to inactivity and an unclear objective.

jassmith avatar May 25 '22 23:05 jassmith

Sorry for the delay here.

We would also like to be able to limit/filter the final positions.

As more of a nice to have, it would be great if we could control how the currently-being-dragged row/column is styled, e.g. lighten or darken or otherwise indicate it is "grabbed".

An extra-nice-to-have would be a way to draw the moving row/column locked to the cursor, something like the gif below, but I imagine that would be a much more substantial undertaking.

column drag

pzcfg avatar May 27 '22 22:05 pzcfg

Actually the ghost thing is much easier since it's sorta built into the browser.

jassmith avatar May 27 '22 23:05 jassmith

This is now possible in 6.0.0 with onColumnProposeMove

jassmith avatar Dec 22 '23 07:12 jassmith

Hi! Nice library, thanks! How i can customize row reordering? I want to implement same styles with ghost like in column drag. Thanks

ekuznetski avatar May 08 '24 19:05 ekuznetski