React-sortable-hoc: Disable drag option

Created on 5 Jan 2018  ·  5Comments  ·  Source: clauderic/react-sortable-hoc

Is there any option to disable drag on first, second or X element?

Most helpful comment

Yes, set the disabled prop to true on the SortableElement, https://github.com/clauderic/react-sortable-hoc#sortableelement-hoc

All 5 comments

any update on this?

You could achieve this using a drag handle, and just not rendering the handle on the ones you want locked

Yes, set the disabled prop to true on the SortableElement, https://github.com/clauderic/react-sortable-hoc#sortableelement-hoc

Sorry for coming back to this, but small question @clauderic
If in the Component with the SortableContainer I have a state variable which I use to disable/enable drag for all SortableElements, and I toggle this state variable using setState, is there a way I can do this without making react-sortable-hoc delete the Nodes?
screenshot 2019-03-04 at 02 45 00 2
I don't want each draggable item to be deleted as I want to keep each individual local state, but just have the disabled prop updated for each element without deleting the node (which will cause it to be removed from dom and reconstructed). Is there a way to do this?

Was this page helpful?
0 / 5 - 0 ratings