Drag and drop file in TreeGrid?

Is it possible to drag and drop file in to specific row of tree grid?
I have file explorer like - https://demo.vaadin.com/sampler/#ui/grids-and-trees/tree-grid/file-system-data-provider , and I need to drag a file into a folder from file system.

Hi,

yes, it’s possible. Check vaadin.com/docs/framework/v8/advanced/advanced-dragndrop.html - there’s a subtopic called “drag and drop rows in TreeGrid”. You’ll need to study the contents of that Docs article to get an idea of how drag + drop works in Vaadin 8.1.

-Olli

I understand how to drag and drop rows within tree grid. But I need to drag a real text file from file system and add it to grid.
I can get the files in FileDropTarget, but the drop target is the whole grid. I need the specific row.
Is there a way to combine TreeGridDropEvent with FileDropEvent? My TreeGridDropEvent in not called.

My plan is - > Drop file → Create POJO based on that file → add file to grid

Ah, now I see what you’re getting at. I think you’ll need to create a custom Extension for that. You should be able to get by just with a a modified/inherited GridDropTarget.

-Olli

Hi,

I would like to the same thing (drop a file inside a row in a TreeGrid “file Explorer”).
Is there any new in Vaadin 8.2 (there is some new stuffs for drag and drop in 8.2 but there are almost no example or I didn’t find them) ?

I will try to do what you suggest but it’s not really easy to understand what to do :smiley:

Thanks,

Sorry to dig out this old post, but it seems that nothing changed : we still cannot drop files onto TreeGrid (or even onto a simple Tree)
Did anyone achieve something similar or have any tip ?

Regards
Sebastien