You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is your feature request related to a problem? Please describe the problem.
Usually, when rendering a tree nodes (either as table (IsTree) or a TreeView), there might have 2 drag/drop scenarios:
Nodes can be draged to any node, which means the Node A1 (a child node of Node A), can drag and drop to Node B and become a child node of Node B, in that case, it needs to
a. change the Node A1's Parent Node to Node B
b. reorder existing Node B's child nodes
Changing parent node is not allowed, but the order of the child nodes can be reordered by drag/drop. In this case, when Node A1 was dragged and dropped to a new position, it needs to:
a. reorder existing Node A's child nodes.
Currently, it's difficult to implement the above functions with Table (IsTree)/TreeView and SortableList. The SortableList doesn't support it. The group option of SortableList is to allow an item drag/drop in different parent container when they have same group name. The filter option is to disallow a node to be dragged. But in this scenario, we'll need to force the child node of Node A can only drag/drop under Node A (scenario 2). Meaning, it needs to disallow a node to be dropped in elsewhere but a specific area.
Describe the solution you'd like
A possible solution might be:
private SortableOption sortableOption = new()
{
RootSelector = "tbody",
Handle = "i.sort-handle",
SortableAmongSameItemsOnly = true, // this is to enable the sortable work on the 2nd scenario
SameItemsClassPrefix = "parentNode_" // this is to check if the items has same class with prefix "parentNode_", if so, it allows to drop.
};
<SortableList @ref="sortableList" Option="sortableOption">
<Table IsTree="true" ...>
...
</Table>
</Sortable>
or an option:
private SortableOption sortableOption = new()
{
RootSelector = "tbody",
Handle = "i.sort-handle",
Filter = "", // this is existing option where you can define items to be undraggable.
FilterToDrop = "" // this should accept either string or a function to check against the dragging item and the item that is under the dragging item.
};
There is other solution with some changes on Table, but that seems more complicated. Not sure if you can think a better solution.
Additional context
No response
The text was updated successfully, but these errors were encountered:
ArgoZhang
changed the title
feat(): Enhance SortableList to support Table (IsTree) and/or TreeView compoment
feat(SortableList): enhance SortableList to support Table (IsTree) and/or TreeView compoment
Jan 12, 2025
Is there an existing issue for this?
Is your feature request related to a problem? Please describe the problem.
Usually, when rendering a tree nodes (either as table (IsTree) or a TreeView), there might have 2 drag/drop scenarios:
a. change the Node A1's Parent Node to Node B
b. reorder existing Node B's child nodes
a. reorder existing Node A's child nodes.
Currently, it's difficult to implement the above functions with Table (IsTree)/TreeView and SortableList. The SortableList doesn't support it. The group option of SortableList is to allow an item drag/drop in different parent container when they have same group name. The filter option is to disallow a node to be dragged. But in this scenario, we'll need to force the child node of Node A can only drag/drop under Node A (scenario 2). Meaning, it needs to disallow a node to be dropped in elsewhere but a specific area.
Describe the solution you'd like
A possible solution might be:
or an option:
There is other solution with some changes on Table, but that seems more complicated. Not sure if you can think a better solution.
Additional context
No response
The text was updated successfully, but these errors were encountered: