kartik-v / yii2-tree-manager

An advanced tree management module using nested sets for Yii 2.
http://demos.krajee.com/tree-manager
Other
150 stars 107 forks source link

Adding immediate parent ID rather than root ID #274

Closed fasi1208 closed 3 years ago

fasi1208 commented 3 years ago

Hi. I am using this widget. It works around in a good way. As you know that there will be N number of parents have N number of child. When a parent is created the root value is the value of its immediate parent. The same thing should be followed with child, for example, take a look of my structure

image

Below is my table structure

image

In above the root id of Floor-1 is 1 which is perfectly ok as it's under the Accurate. But for GIS Office the root is also 1. I think the root should be 2 as the parent of GIS is Accurate having ID 2 and vice versa.

The reason that I have mentioned it is that it will help us to track/check/get all child nodes under the parent node. If there is any other way around to get all the child nodes of the parent nodes. For now, there is no tag/id for parent-child relationships in the table

fasi1208 commented 3 years ago

No one to post an answer?

kartik-v commented 3 years ago

If you need a new root - you need to click/use the CREATE ROOT NODE button (the TREE ICON sign) and not the CREATE NEW NODE button. The CREATE NEW NODE button will always create a child node under the selected parent node - while the CREATE ROOT NODE will create a NEW tree root. Check the documentation and also a image snapshot.

image