Skip to main content



      Home
Home » Eclipse Projects » NatTable » Multi row DnD
Multi row DnD [message #1717509] Mon, 14 December 2015 08:39 Go to next message
Eclipse UserFriend
Hello.
Is it possible to configure the NatTable in any way so that you can drage and drop multiple rows?
Currently the NatTable selects the row at mouse cursor on mouse down. That makes it impossible to preserve the multi selection when the drag starts.

There seems to be a MultiRowReorderCommand which might fit for my use case, but how can I give it the fromRowPositions when they are always cleared on mouse down?

Regards
Tommy

[Updated on: Mon, 14 December 2015 08:42] by Moderator

Re: Multi row DnD [message #1717528 is a reply to message #1717509] Mon, 14 December 2015 10:19 Go to previous messageGo to next message
Eclipse UserFriend
Are you talking about row reording via row header or are you talking about drag and drop?

For the first one, you basically need to implement a custom RowReorderDragMode that has a relation to the SelectionLayer and reads the from position from the current active selection instead of the current mouse position. And there you fire the multi command instead of the start and end commands that only can carry one value.
Re: Multi row DnD [message #1717606 is a reply to message #1717528] Tue, 15 December 2015 04:13 Go to previous messageGo to next message
Eclipse UserFriend
Hi Dirk,

thanks for the hint so far.
Yes I mean a column/row reordering.
The RowReorderDragMode was one of the problems because it always sends a ClearAllSelectionsCommand in the mouseDown method. I have overwritten this class and removed the Command call so the selection stays now when dragging. Is there a reason why the selection should be cleared when drag starts (mouse down)?
But we still got the problem that every mouse down (so also a drag) sets the selection to the row/column at the mouse cursor. So getting the selection from the selection layer in my DragMode always returns this single item even though I got several items selected when drag started. Is it possible to turn this behavior off or to set the selection on mouseUp instead of mouseDown?

Regards
Re: Multi row DnD [message #1717615 is a reply to message #1717606] Tue, 15 December 2015 04:52 Go to previous messageGo to next message
Eclipse UserFriend
Quote:
Is there a reason why the selection should be cleared when drag starts


IIRC for correct rendering and correct states on updating. Since the selection is not taken into account by the default implementation, it is better to clear it to avoid inconsistent states.

Quote:
Is it possible to turn this behavior off or to set the selection on mouseUp instead of mouseDown?


You need to override the selection behavior in the DefaultSelectionBindings. There you will find the registering of the row header selection bindings on mousedown. You can try to change this to registering on singleClick.
Re: Multi row DnD [message #1717641 is a reply to message #1717615] Tue, 15 December 2015 09:06 Go to previous message
Eclipse UserFriend
Ok thank you. Overriding the DefaultSelectionBindings was the trick. Resolved Wink
Previous Topic:Hide horizontal lines only
Next Topic:display long texts in cell
Goto Forum:
  


Current Time: Wed Jun 18 21:18:57 EDT 2025

Powered by FUDForum. Page generated in 0.10746 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top