开发者

Flex -- Drag enable leaf nodes only in tree component

开发者 https://www.devze.com 2023-02-09 06:22 出处:网络
Is there a way to enable dragging of only leaf nodes in a tree c开发者_运维问答omponent?First you need to intercept the dragStart event from your tree

Is there a way to enable dragging of only leaf nodes in a tree c开发者_运维问答omponent?


First you need to intercept the dragStart event from your tree

dragStart="tree_dragStartHandler(event)"

Then in the event handler you can check to see if the selected item is a branch, if it is then you cancel the dragStart event's default behavior with preventDefault()

protected function tree_dragStartHandler(event:DragEvent):void
{
    var item:Object = event.currentTarget.selectedItem
    if (tree.dataDescriptor.isBranch(item)) {
        event.preventDefault();
    }
}
0

精彩评论

暂无评论...
验证码 换一张
取 消