I have been through the docs and searched the forum I am not sure how I can accomplish this. I want to mimic a file system with folders and files. I want to disable the ability to drop a “File” on another “file” and only allow “files” to be dropped on “folders”.
Is there a function or attribute that I can set to enable/disable the ability for an item to have other items dropped on them? As a n00b to dhtmlx a code example would be of tremendous help.
You can use “onBeforeDrag” and “onDragIn” event to control which item should be draggable in Tree.
With all due respect, that does not address my original query. If it does I do not see how. Everything should be dragable, I want to prevent items from being dropped on some items (folders).
Let me restate the question:
How do I prevent items from being dropped on certain predetermined items in a tree?
I have scoured the documentation and it seems that this is not possible. My purchase decision was based on the ability to do this. Oh well, live and learn.
I want to disable the ability to drop a “File” on another “file” and only allow “files” to be dropped on “folders”.
I do this, which works for me:
In my xml file I include userdata for each item that - among other things - identifies an item as folder or file. I use the dragging events, as pointed out by Olga to examine the userdata of the item I am currently hovering over. At that point I know if it is a valid drop location.
I do not see Dhtmlx respond to the return values of onDragIn. Return true or return false does not provide me with the expected result (or I have failed to identify the behaviour). Instead, I change the css of the row to highlight it only if it is a valid drop location. During onDrop of perform the same verification and cancel or proceed the drop.
brugmanjoost
Could you explain, what kind of issue you have? To identify it is necessary to get more info.
F.e. attach your code (currently part of it). May be you will not need to put userdata to all your items.
Get a guaranteed answer from DHTMLX technical support team
under the most suitable support plan