开发者

Can a node in dynatree have several parents?

开发者 https://www.devze.com 2022-12-28 09:11 出处:网络
Using this http://wwwendt.de/tech/dynatree/ I know the answer is probably no, but I want to verify this: can a node have several parents in this开发者_Python百科 component?That would mean, that nodes

Using this http://wwwendt.de/tech/dynatree/

I know the answer is probably no, but I want to verify this: can a node have several parents in this开发者_Python百科 component?


That would mean, that nodes with identical properties (title, icon, and other attributes) appear at different locations in the tree. This is possible, of course.

The only restriction is: It's not allowed to have two nodes with the same key property in one tree.

I think that the behaviour would be hard to define, if nodes where really 'identical'. For example, when you activate one node that has multiple parents, would you expect all instances to be highlighted? And then, when you press [Cursor-Left]: which parent should be navigated to?

But you could add a new property like myBackendKey whith the same value for all node instances.


Yes, a node in DynaTree can have multiple parents. That is: one identical node can be assigned to more than one parent node in the same tree. I am using jQuery Dynatree Plugin v1.2.2.

I've just now encountered a situation where I've had to deal with duplicate nodes in conjunction with navigating from current node to its next/prev sibling.

Since I had dublicate nodes in the tree, the navigation was broken. When querying the tree for a node with key "abc", dynatree will give you only the first occourance of the node with that key (and not care about the remaining nodes with the same key).

Solution: To prevent this from happening, I've simply prefixed the key for duplicate nodes with a unique string.

0

精彩评论

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