防止节点掉落到Primefaces树中某些类型的节点上 [英] Prevent nodes to be dropped on nodes of certain type in Primefaces tree

查看:103
本文介绍了防止节点掉落到Primefaces树中某些类型的节点上的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一棵树,我的代码是:

I have a tree and my code is:

<p:tree id="tree_newCms_pl"
        value="#..............."
        var="item"
        animate="true"
        selectionMode="single" selection=".............."
        dynamic="true"
        draggable="true" droppable="true">

我只想允许更改节点的位置,并防止将其放置到其他父节点上。我该如何解决?

I only want to allow to change the position of a node, and prevent it from being dropped onto a different parent. How can I fix this?

推荐答案

可以使用属性来完成。 dropRestrict = sibling

This can be done using an attribute. dropRestrict="sibling".

<p:tree id="tree_newCms_pl"
        value="#..............."
        var="item"
        animate="true"
        selectionMode="single" selection=".............."
        dynamic="true"
        draggable="true" droppable="true" dropRestrict="sibling">

根据文档


定义父子限制当节点被删除时,有效值
为none(默认值)且为兄弟。

Defines parent-child restrictions when a node is dropped valid values are none (default) and sibling.

这篇关于防止节点掉落到Primefaces树中某些类型的节点上的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆