Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by john on Mar 09, 2008 05:48
open dhtmlx forum
dhtmlXTree drag-and-drop

Say I drag an object (e.g. that represents a book) into a folder (that represents categories of books) in a tree. How can I forward the title of the book and the folder name (the book category folder that I dragged the book to) to another page.

I guess this is a two part question; first how do I "get" information about the object I just dragged over (the title of the book) and about the folder I dragged the book into (e.g. the name of the folder - the book category). Is there some sort of "trigger" that happens once I drag something into tree?

Second, once I have that information how do I forward that information to another page? I know how to forward information using html or javascript, I am unclear how to do it using the dhtmlXTree package.
Answer posted by Support on Mar 10, 2008 06:04
>>Is there some sort of "trigger" that happens once I drag something into tree?
Tree provides few events for d-n-d process, in your case onDrag event is a better choice

    tree.attachEvent("onDrag",function(sid,tid){
       alert("draged "+sid+", into the "+tid)
       return true;
    })

the sid and tid are IDs of source and target items, event will be fired when some item dragged and dropped on other item.

>>once I have that information how do I forward that information to another page?
By using event described above you will have all necessary info, so only step which necessary - change URI
    document.location.href='second.html?sid='+sid+"&tid="+tid;