'Is there a way to disable sorting in react-sortable--hoc
I have a requirement where the sorting of the list depends on the state which can be toggled using a button. The user should be able to sort only when he is in the editing mode. So I need to disable the sorting of the list. Can anyone help me out on how to add the disabled key to the SortableElement in react-sortable-hoc. I tired to search a working example on google but couldn't find any. Can anyone out there help me out on this one?.
Solution 1:[1]
From reading the documentation, seems like SortableElement supports a disabled flag, you could set the disabled flag to:
<SortableItem ... disabled={editable}/>
Where SortableItem is a wrapper of SortableElement.
If you notice how SortableElement is defined, it just takes config where you can just pass the disabled flag. Hopefully this solves your issue.
Solution 2:[2]
This worked for me,
<Sortable
options={{disabled:true, ...}} > ...
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | |
| Solution 2 | Thushara Buddhika |
