Drag & drop of files from Windows explorer to D3TreeView

0
We are using  D3TreeView widget successfully to View/Add/Delete files from a windows Server location into mendix application. I see in the documentation that there is a drag & drop functionality available but I couldn't figure how to enable drag & drop of files (from windows explorer) to a node in D3Treeview in order to save file in that location. Please share if you have achieved something similar in a Mendix application. Let me know if you know of any other widget which can help us achieve drag-&-drop of files.
asked
3 answers
0

Hi Atul,

I’ve seen someone use the tree view widget alongside the drop zone widget to accomplish what you are describing. 

https://appstore.home.mendix.com/link/app/916/FlowFabric-BV/Dropzone

 

Another option is to see how the drop zone widget accepts a file from windows and make some edits to the tree view widget.

 

Hope this helps!

answered
0

Some extra info on Dropzone:

answered
0

There seems to be something like

d3.event.dataTransfer.files

You can add a drop event handler and combine that with api calls to savedocument

https://apidocs.mendix.com/7/client/mx.data.html#.saveDocument


Snippet (sample code)

var fileBlob = document.querySelector("input[type=file]").files[0];
mx.data.saveDocument("123456", "Bunnies.jpg", { width: 180, height: 180 }, fileBlob, function() {
  // success
}, function(e) {
  console.error(e);
});

but you will need to adapt the Mendix widget for this.

answered