P
P
Pavel Gogolinsky2016-10-13 12:01:07
Yii
Pavel Gogolinsky, 2016-10-13 12:01:07

How to sort trees in yii2 when using yii2-nested-sets?

I use nested sets with multiple trees. Non-root elements can be sorted using appendTo. And how to sort entire trees (change the tree attribute)?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
Maxim Timofeev, 2016-10-13
@gogolinsky

If you need to change the position of an element or elements within the tree, you need to change lft, rgt and, if necessary, depth, including for descendants. If the trees are not part of another tree, then you can enter the sort attribute and sort by it. Perhaps tree can also be used as sort, but it depends on the architecture

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question