Project

General

Profile

Drag and Drop functionality with client side Js not possible with Wt- ExtJs?

Added by Dinu Ajikutira over 14 years ago

Hi Koen, Wim,

I have code I am trying to port to Wt and am having trouble with the drag and drop functionality. I want the drag and drop to happen on the client side, and my current Javascript code is something like this:

var dragsource=new Ext.dd.DragSource("sourceDiv", {ddGroup:'TreeDD',dragData:{name: "PNG1"}});

var droptarget=new Ext.dd.DropTarget("CenterDiv",{ddGroup:'TreeDD'});

droptarget.notifyDrop=function(dd, e, data)

{

if(data.name)

{

Some logic here...;

return true;

}

}

The sourceDiv and CenterDiv are

elements which have random id in Wt, so the droptarget.notifyDrop should be defined after the elements are created (I guess). But I can't get this to work. No matter how I add the notifydrop function (using doJavaScript, declareJavaScriptFunction or simply adding it as string in the createDomElement) I cannot get this to work. In fact nothing appears on the screen if I try to define this function.

Do you know what is going on? I really have to have the drag drop happen on the client machine, and not come back to the server. Is there any way I can accomplish this with Wt?

Thanks

-Dinu


Replies (2)

RE: Drag and Drop functionality with client side Js not possible with Wt- ExtJs? - Added by Wim Dumon over 14 years ago

any extra information that you can share? Are there any JS errors (from firebug or another debug console? How does your C code looks like? If you look at the response data in your browser debugger, what is wrong?

RE: Drag and Drop functionality with client side Js not possible with Wt- ExtJs? - Added by Dinu Ajikutira over 14 years ago

Hi Wim,

Thanks for the response! I am very glad to see that you guys always respond to queries which makes Wt all the more desirable!

Actually there is no JS errors and the browser is simply blank with no response what so ever. The Ext JS files are not laded either.

I am not on my computer now, so I don't have the piece of code you wanted to take a look at.

In any case, I have followed your dragdrop example and got my code working the way I want. I might be forced to get back to this due to some dependency I encounter in the future, and I think I'll cross the bridge when I come to it. For now I am moving forward with my porting my code to Wt...

-Dinu

    (1-2/2)