[drag-drop] Allow to disable sorting within a CdkDropList
See original GitHub issuePlease describe the feature you would like to request.
I want to be able to disable sorting within a CdkDropList. That is, I want to be able to drag items from a CdkDropList to it’s connected CdkDropList, while not allowing items within the source CdkDropList to be swapped (sorted).
I guess it would be used as an input of CdkDropList, something like this: @Input('cdkDropListSortable') sortable: boolean
, that when true will disable sorting within the drop list.
Also, if there’s a way to achieve this behavior using the current API, I would love to hear about that. Searching online I found a few people asking the same question (https://stackoverflow.com/questions/53380336/how-to-disable-sort-in-a-cdkdroplist-using-angular-cdk-v7-0-0), but none received a relevant answer.
Thanks!
Issue Analytics
- State:
- Created 5 years ago
- Reactions:7
- Comments:14 (1 by maintainers)
Top Results From Across the Web
How to disable sort in a CdkDropList using angular cdk v7.0.0+
Let's say I have List A and List B. I'm dragging from A to B, I would like to disable the sorting while...
Read more >Drag&Drop disabled sorting - StackBlitz
can be found in the LICENSE file at http:/ /angular.io/license -->.
Read more >Drag and Drop | Angular Material
The drag-and-drop module supports animations both while sorting an element inside a list, as well as animating it from the position that the...
Read more >How to disable sort in a CdkDropList using angular cdk v7.0.0+
You could try setting the cdkDropListLockAxis input to 'x' on the container you don't want to sort, in your case the first list....
Read more >Drag and Drop | Angular Material
Service that allows for drag-and-drop functionality to be attached to DOM elements. ... Element that can be moved inside a CdkDropList container.
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
I too want to just disable the sorting and only allow dragging between lists and on items. An usecase I’m working on is for example an already sorted file/folder list. I want to be able to drag and drop files on folders, not order them.
Hello @crisbeto thank you for your reply. Bit this would disable the dragging completely. I think @yarinr has the same issue I have. I want to drag something out of a list. And I use a clone method to do that. What I do not want is that, while I drag my object over the other list items, those will also be sorted. Does this make sense?
I tried
cdkDropListDisabled
but this seems not to work when you are starting in the cdkDropListPS: This is also part of the #13100 issue discussion