Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by sandro on Nov 12, 2007 11:33
open dhtmlx forum
drag and drop any item

Hi,

I got your response http://www.dhtmlx.com/docs/products/kb/index.php?s=normal&q=1183&a=1154

Could you provide more information? I've managed to cobble together the following, which seems to be somewhat correct (hilites happen, no errors) but the dragging still doesn't occur.

<div id="dragtester">testdrag</div>

function init()
{
dropper=new dragFunc();
dragger=new dhtmlDragAndDropObject();

var item = document.getElementById('dragtester');

dragger.addDraggableItem(item,dropper);

function dragFunc()
{
this._createDragNode=function(node)
{
var dragSpan=document.createElement('div');
     dragSpan.style.position="absolute";
dragSpan.innerHTML="<img src=\""+node.getAttribute("src")+"\">";
dragSpan.style.zIndex=12;
};

this._drag=function(sourceHtmlObject,dhtmlObject,targetHtmlObject)
{
                 targetHtmlObject.style.backgroundColor="";
                 //targetHtmlObject.value=sourceHtmlObject.parentObject.label;

             }

             this._dragIn=function(htmlObject,shtmlObject)
             {
                 htmlObject.style.backgroundColor="#fffacd";
                 return htmlObject;
             }

            this._dragOut=function(htmlObject)
             {
                 htmlObject.style.backgroundColor="";
                 return this;
             }
}

}
Answer posted on Nov 13, 2007 05:10
Please check attached sample it uses code from your snippet.

Item in top frame registered as dragable, item in sub frame registered as drag landing.
The drag-controller object basically the same in both iframes
The real drag-n-drop logic described in _drag method of target controller.
Attachments (1)
common.zip7.55 Kb