AFAICT, this is not how you handle file drops: https://developer.mozilla.org/en-US/docs/Web/API/HTML_Drag_and_Drop_API/File_drag_and_drop and GWT's drag and drop API doesn't support what's needed here. You'd have to use Elemental2 (com.google.elemental2:elemental2-dom) which should have everything.
On Monday, May 15, 2023 at 12:57:20 AM UTC+2 [email protected] wrote: > Hello Team, > > I am new to GWT and working on an existing code. I am trying to implement > a drag and drop functionality .I am having issues getting data from > DataTransfer object. I need to drag and drop any file from the computer on > the widget. > > > > > > *grid.addDropHandler(new DropHandler() { @Override > public void onDrop(DropEvent event) { > event.preventDefault();* > * DataTransfer dataTransfer = > event.getNativeEvent().getDataTransfer();* > * dataTransfer.setDropEffect(DropEffect.COPY);* > * Object data = dataTransfer.getData("File");* > > * } });* > > I am getting an empty-string on dataTransfer.getData("file")' > How can we set the format "File" while doing dataTransfer.setData(); > I think I am doing something wrong here . Please advice. > > Thank you > Ronit > -- You received this message because you are subscribed to the Google Groups "GWT Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/google-web-toolkit/e027dbe4-120e-4e1e-a42c-a21f4a95b033n%40googlegroups.com.
