vbjain
14 Apr 2012, 1:48 AM
I have updated the question with more explanation and sample code in below post. Please check that.
Hello All,
I am using GXT 2.2.4 for UI development. I have used HTML5 for Dragging file from Desktop to my application and upload it. But now i am having reverse requirement. I want to drag files from GXT Grid to desktop which will download the file to desktop.
I know that is possible in Chrome only. And had checked the below demo: http://www.thecssninja.com/javascript/gmail-dragout
I had tried to implement the above code in my GXT application, but the issue is that i am using EditorGrid which is supporting DnD. Now when i drag from grid to Desktop its not capturing the native "dragStart" event (which is required to getDataTrasnfer() and set the "url" to it, as above link says).
After so much debug i came to know that GRID using its Selection Model which is stopping the browser from firing the "dragStart" event. Can anyone let me know what should i write so Grid's DnD operation also keep working and native browser's "dragStart" event do fire?
Or if i override the "DragStart" of GridDragSource, then i am getting event.getEvent().getDataTrasnfer() as NULL. Any idea why is it so? Any idea, how it should be done?
Below is the small piece of code which i call after the Data had been inserted in Grid. All records are having the CSS class name as ".icon". The problem is that when i start to drag, the "dragstart" is not being called. Any suggestion?
NOTE: This code is working when i create Buttons, Labels, etc and making them draggable=true with other required parameters.
public static native void test(String id)/*-{
var files = $doc.querySelectorAll('.icon');
for (var i = 0, file; file = files[i]; ++i) {
file.addEventListener("dragstart",function(evt){
$wnd.alert("Drag Event started.. ");
evt.dataTransfer.setData("DownloadURL",this.dataset.downloadurl);
},false);
}
}-*/;
Thanks.
Hello All,
I am using GXT 2.2.4 for UI development. I have used HTML5 for Dragging file from Desktop to my application and upload it. But now i am having reverse requirement. I want to drag files from GXT Grid to desktop which will download the file to desktop.
I know that is possible in Chrome only. And had checked the below demo: http://www.thecssninja.com/javascript/gmail-dragout
I had tried to implement the above code in my GXT application, but the issue is that i am using EditorGrid which is supporting DnD. Now when i drag from grid to Desktop its not capturing the native "dragStart" event (which is required to getDataTrasnfer() and set the "url" to it, as above link says).
After so much debug i came to know that GRID using its Selection Model which is stopping the browser from firing the "dragStart" event. Can anyone let me know what should i write so Grid's DnD operation also keep working and native browser's "dragStart" event do fire?
Or if i override the "DragStart" of GridDragSource, then i am getting event.getEvent().getDataTrasnfer() as NULL. Any idea why is it so? Any idea, how it should be done?
Below is the small piece of code which i call after the Data had been inserted in Grid. All records are having the CSS class name as ".icon". The problem is that when i start to drag, the "dragstart" is not being called. Any suggestion?
NOTE: This code is working when i create Buttons, Labels, etc and making them draggable=true with other required parameters.
public static native void test(String id)/*-{
var files = $doc.querySelectorAll('.icon');
for (var i = 0, file; file = files[i]; ++i) {
file.addEventListener("dragstart",function(evt){
$wnd.alert("Drag Event started.. ");
evt.dataTransfer.setData("DownloadURL",this.dataset.downloadurl);
},false);
}
}-*/;
Thanks.