开发者

Flex -- Drag enable leaf nodes only in tree component

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜