dnd-kit-sortable-tree icon indicating copy to clipboard operation
dnd-kit-sortable-tree copied to clipboard

Issue with disableSorting when using SimpleTreeWrapper

Open Phazia opened this issue 3 years ago • 3 comments

Tried applying the disableSorting property as a prop in the SimpleTreeWrapper, but sorting is still enabled for the item.

It appears that when console logging the props object, it's undefined and getting reset to undefined on each render. Any ideas why?

Will attach a video soon.

Phazia avatar Nov 05 '22 20:11 Phazia

I'd think about making this more clear on the API level.. Currently you need to set disableSorting for the item in the items data provided to the SortableTree (check the sample: https://github.com/Shaddix/dnd-kit-sortable-tree/blob/9b45628f680f00bbffafebc5d9a22263886b4b72/stories/components/folder/FolderRoot.tsx#L28)

Shaddix avatar Nov 07 '22 00:11 Shaddix

image

I've added the property to the item-data object (referencing the above photo). I've also added properties like canHaveChildren which work as intended.

When console logging the props, I'm seeing undefined values for disableSorting: image

Setting the entire tree to have disableSorting works as intended.

Also, thank you for your patience! Will take a look at the source code later this week if there's a bug and make a PR once solved.

Phazia avatar Nov 07 '22 20:11 Phazia

I have same problem. canHaveChildren works perfectly for items, but disableSorting not. Any fixes?

Adam-rGz avatar Dec 15 '23 10:12 Adam-rGz