-
Notifications
You must be signed in to change notification settings - Fork 4.1k
Description
What problem does this feature solve?
Currently, the nzDraggable feature in the Tree component allows reordering of nodes across different levels, but does not allow users to reposition or reorder nodes within the same parent level (i.e., among sibling nodes). This limits flexibility for applications where maintaining the same hierarchy while reordering is necessary, such as in CMS page builders or nested task managers.
For example, if a user wants to move the 3rd child node to become the 1st child within the same parent, this is not currently possible.
This creates a poor end user experience when precise organization is important but constrained by the API’s current behavior.
What does the proposed API look like?
We propose enhancing the existing drag-and-drop support by allowing drag-and-drop reordering of sibling nodes under the same parent.
This could be enabled by adding an additional config option like:
<nz-tree [nzData]="nodes" nzDraggable [nzAllowSameLevelDrop]="true" (nzOnDrop)="onDrop($event)"> </nz-tree>
New property:
nzAllowSameLevelDrop: boolean – When true, allows reordering nodes at the same level.
The nzOnDrop event should return updated positions, allowing devs to rearrange data accordingly.