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
{{ message }}
Repository navigation
[drag-drop] Allow to disable sorting within a CdkDropList #14838
P3An issue that is relevant to core functions, but does not impede progress. Important, but not urgentfeatureLabel used to distinguish feature request from other issues
Please 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.
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 cdkDropList
<ulid="container_list"
cdkDropList[cdkDropListConnectedTo]="['#dropbucket']"
[cdkDropListDisabled]="isDragging"><licdkDrag(cdkDragStarted)="dragStarted($event)"
(cdkDragEnded)="dragEnded($event)"
*ngFor="let draggable of draggables"
>
test</li></ul>
@creadicted Yes, that's exactly what I mean. @crisbeto See the reply by @creadicted - cdkDropListDisabled does not achieve the behavior I'm talking about.
I saw request in multiple locations. In the past I played around with other d&d components. Like https://github.com/bevacqua/dragula . They expose a function that allows to manipulate what to do when hovering over a 'bucket'. So you could intercept the sorting behavior. A simple option would be easier.
For a quick you can just have an cdkDropList around each cdkDrag object. But that is definitely not a nice solution.
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.
Reacted by Yarin Ronel, Angel Todorov, Dmitry, Lord Midi, Hugh Anderson, FRANCISCO QUALLIO MARQUES and a-lobo
I saw request in multiple locations. In the past I played around with other d&d components. Like https://github.com/bevacqua/dragula . They expose a function that allows to manipulate what to do when hovering over a 'bucket'. So you could intercept the sorting behavior. A simple option would be easier.
For a quick you can just have an cdkDropList around each cdkDrag object. But that is definitely not a nice solution.
Alternatively you can just override css transform on you cdkDrag, by setting it to transform: none !important. The cdkDropList still changes transform, but it has no effects.
May be it will break some animations, but drop event works perfectrly with current and previouse indexes.
I'm also needing this feature as I have a (huge) static list which should not be sorted but provides items to be dropped into another list (which can be sorted).
Reacted by Yarin Ronel, dimitrov9 and David Jacobsen
You can just set above your source list that you want to disable copy of source list without CDK drag attributes after dragStarted event, it works fine, if you think that it bad decision write - why? trigger for appear of fake block you can use - dragStarted(event: CdkDragStart) { this.isDragging = true; }
I have one case, too. If folder and files in the same CdkDropList, what can I do. [cdkDropListSortingDisabled] option doesn't support this.
Looking into the branches/tags this will be included in the release of version 8 of Angular Material. It's allready in the RCs I think. But this requires an update to Angular 8. Very sad that it hasn't been released in a v7.x version :-(
You can just set above your source list that you want to disable copy of source list without CDK drag attributes after dragStarted event, it works fine, if you think that it bad decision write - why? trigger for appear of fake block you can use - dragStarted(event: CdkDragStart) { this.isDragging = true; }
I don't need connected lists. This is for connected lists.
Looking into the branches/tags this will be included in the release of version 8 of Angular Material. It's allready in the RCs I think. But this requires an update to Angular 8. Very sad that it hasn't been released in a v7.x version :-(
I think, it won't be released for angular 7.
angular-automatic-lock-bot commented on Sep 10, 2019
P3An issue that is relevant to core functions, but does not impede progress. Important, but not urgentfeatureLabel used to distinguish feature request from other issues
Activity
crisbeto commentedon Jan 15, 2019
This sounds very close to the
cdkDropListDisabledinput. Does it do what you need?creadicted commentedon Jan 15, 2019
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
cdkDropListDisabledbut this seems not to work when you are starting in the cdkDropListPS: This is also part of the #13100 issue discussion
yarinr commentedon Jan 15, 2019
@creadicted Yes, that's exactly what I mean.
@crisbeto See the reply by @creadicted -
cdkDropListDisableddoes not achieve the behavior I'm talking about.Thank you both for your input!
creadicted commentedon Jan 16, 2019
I saw request in multiple locations. In the past I played around with other d&d components. Like https://github.com/bevacqua/dragula . They expose a function that allows to manipulate what to do when hovering over a 'bucket'. So you could intercept the sorting behavior. A simple option would be easier.
For a quick you can just have an
cdkDropListaround eachcdkDragobject. But that is definitely not a nice solution.frankvdb7 commentedon Jan 23, 2019
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.
maknapp commentedon Jan 29, 2019
This issue is similar to #13906
MrDywar commentedon Jan 29, 2019
Alternatively you can just override css transform on you cdkDrag, by setting it to
transform: none !important. The cdkDropList still changes transform, but it has no effects.May be it will break some animations, but drop event works perfectrly with current and previouse indexes.
LordMidi commentedon Feb 1, 2019
I'm also needing this feature as I have a (huge) static list which should not be sorted but provides items to be dropped into another list (which can be sorted).
feat(drag-drop): add the ability to disable sorting in a list
feat(drag-drop): add the ability to disable sorting in a list
feat(drag-drop): add the ability to disable sorting in a list
feat(drag-drop): add the ability to disable sorting in a list
feat(drag-drop): add the ability to disable sorting in a list (#15064)
ceyhunn commentedon May 13, 2019
I have one case, too. If folder and files in the same CdkDropList, what can I do.
[cdkDropListSortingDisabled]option doesn't support this.DenisDremkov commentedon May 15, 2019
You can just set above your source list that you want to disable copy of source list without CDK drag attributes after dragStarted event, it works fine, if you think that it bad decision write - why? trigger for appear of fake block you can use - dragStarted(event: CdkDragStart) { this.isDragging = true; }
LordMidi commentedon May 15, 2019
Looking into the branches/tags this will be included in the release of version 8 of Angular Material. It's allready in the RCs I think. But this requires an update to Angular 8. Very sad that it hasn't been released in a v7.x version :-(
ceyhunn commentedon May 16, 2019
I don't need connected lists. This is for connected lists.
ceyhunn commentedon May 16, 2019
I think, it won't be released for angular 7.
angular-automatic-lock-bot commentedon Sep 10, 2019
This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.
Read more about our automatic conversation locking policy.
This action has been performed automatically by a bot.