Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by Rasmit on Jul 24, 2009 04:13
open dhtmlx forum
Restrict drag based on the node image

Hi,
I want to restrict drag n drop feature in tree by checking the dragged node images.

My requirement is, i should not allow dragging of branch node. Only leaf node will be dragged and dropped.

Help need for:

1- How to check the dragged node image name ?
2- Based on various images how could i restrict the drag n drop functionality ?

Kindly help ASAP.
Answer posted by Alex (support) on Jul 24, 2009 05:34

Hello, 

there is hasChildren method that can be used know if item is a leaf or a folder.

For example:

tree.attachEvent("onDrag",function(sourceId,targetId){

return !tree.hasChildren(sourceId)

})

If you need to know item image, you can use the following method var url = tree.getItemImage(itemID)