Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by Àlex Corretgé on Jan 17, 2008 11:11
open dhtmlx forum
Drop items into a Trash image

I need to enable drag&drop to drop items into a Trash image.

I try on error with
tT=document.getElementById('treeT');
tA.dragger.addDragLanding(tT, new s_control);

and

tA.makeDragable(tT);


but when I drop an item, I can work with the item but this is not moved.

         this._drag=function(sourceHtmlObject,dhtmlObject,targetHtmlObject){
         targetHtmlObject.alt= 'Last item deleted: ' + sourceHtmlObject.parentObject.label
         return true;
         }

Any suggerence?

Kind Regards
Àlex Corretgé
Answer posted by Support on Jan 18, 2008 01:37
When you perform d-n-d on custom HTML container, component doesn't know how to process it correctly, so all related events will be called but without any automatic changes in tree structure.
In your case, if you need to have "delete" functionality it may be coded similar to next

    this._drag=function(sourceHtmlObject,dhtmlObject,targetHtmlObject){
         targetHtmlObject.alt= 'Last item deleted: ' + sourceHtmlObject.parentObject.label
         sourceHtmlObject.parentObject.treeNod.deleteItem(sourceHtmlObject.parentObject.id);  // tree.deleteItem(id);
         return true;
         }