简体   繁体   中英

Flex Tree: prevent drop outside folder

How do I prevent a user from dropping an item outsider a folder? My dataProvider is only 1-level deep.

It seems that with a DragEvent handler or DragDrop handler I can find the data of the item I'm dragging, but not where I'm dropping ( so I can prevent it ).

The Tree has been giving me such problems all last week. Any helpful tips would be really appreciated.

Thanks!

I found a work-around, although it doesn't allow me to visually prevent a drop. I leave the dragEnabled and dropEnabled properties of the Tree to true and I check for null in the _dropData.parent property in the dragDrop event. For now, this works.

use namespace mx_internal; var dropData:Object = this.marksTree.mx_internal::_dropData;

if( dropData.parent == null ){
 event.preventDefault();
 this.marksTree.hideDropFeedback(event);
 return;
}

It's very tricky working with the Tree. I hope at some point they expose the dropData property a little more clearly.

I hope this helps someone.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM