DND Cursor when dragging rows in a grid

I have create a treegrid displaying contents of a file system.
The user is already able to move files to different folders using DND, which I enabled via Grid.setRowsDraggable(true) and appropriate listeners to perform changes from the DND operation (drag start, drag end, drop).

The only bad thing is that the grid always indicates a copy operation with the cursor shown when dragging (cursor with a small plus sign).
I would like to change this have no clue how to do this for the grid, as there is nothing like setting the effectAllowed as for the generic drag and drop.

The ideal solution would be that the user can also hold down a modifier key like SHIFT to enable copy-mode (with changing the icon), and using the default move cursor otherwise.

Any ideas how this can be done? Or is it impossible?

With normal components that is controllable, but didn’t find Java API too configure it for rows:

Paragraph paragraph = new Paragraph("T");DropTarget<Paragraph> dropTarget = DropTarget.configure(paragraph, true);dropTarget.setDropEffect(DropEffect.LINK);```

BTW. The default effect seems to be varying based on browser/OS. For me there is no effect by default (Safari, Mac). With Chrome it seems that plus is the default. Also modifiers seems to vary…

I’d guess setting effects for rows shouldn’t be too hard to implement. Could you fill an enhancement issue to GitHub - vaadin/flow-components: Java counterpart of Vaadin Web Components ?

Sounds similar to https://github.com/vaadin/web-components/issues/5548

That’s related, but not the same. This is about the plus/arrow/no-symbol next to the cursor.

Note that the feature comes in two parts: the drag source defines the allowed effect, and the drop target defines the drop effect. The drop effect not only changes the cursor, but also limits the places where you can drag from. And you might want to configure a different drop effect and allowed effect for each row, so what’s really needed is a generator for both properties for each row, and also additional configurations for edge cases (between rows, at the empty area)

For example: you might want to allow copying every row that is somehow “original”, and copying only works if you drop on the empty area at the end of the Grid, whereas moving might only be allowed for “copies”, and moving is allowed only between rows. Or something like that.

the limitation of the drag source based on the allowed effect is a built-in browser feature, so it’s not something you can check on the server

i already added a github issue yesterday, guess you already found it.
https://github.com/vaadin/flow-components/issues/4729

Found it now and gave it a thumb up :+1: