-
Notifications
You must be signed in to change notification settings - Fork 6.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[drag-drop] Allow to disable sorting within a CdkDropList #14838
Comments
This sounds very close to the |
Hello @crisbeto thank you for your reply. Bit this would disable the dragging completely. I tried <ul
id="container_list"
cdkDropList
[cdkDropListConnectedTo]="['#dropbucket']"
[cdkDropListDisabled]="isDragging">
<li
cdkDrag
(cdkDragStarted)="dragStarted($event)"
(cdkDragEnded)="dragEnded($event)"
*ngFor="let draggable of draggables"
>
test</li>
</ul> dragStarted(event: CdkDragStart) {
this.isDragging = true;
}
dragEnded(event: CdkDragEnd) {
this.isDragging = false;
} PS: This is also part of the #13100 issue discussion |
@creadicted Yes, that's exactly what I mean. Thank you both for your input! |
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 |
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. |
This issue is similar to #13906 |
Alternatively you can just override css transform on you cdkDrag, by setting it to 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). |
Adds the ability to disable sorting inside of a `CdkDropList`. This allows for use cases where one list is considered the source and one or more connected lists are the destinations, and the user isn't supposed to sort the items within the source list. Fixes angular#14838.
Adds the ability to disable sorting inside of a `CdkDropList`. This allows for use cases where one list is considered the source and one or more connected lists are the destinations, and the user isn't supposed to sort the items within the source list. Fixes angular#14838.
Adds the ability to disable sorting inside of a `CdkDropList`. This allows for use cases where one list is considered the source and one or more connected lists are the destinations, and the user isn't supposed to sort the items within the source list. Fixes angular#14838.
Adds the ability to disable sorting inside of a `CdkDropList`. This allows for use cases where one list is considered the source and one or more connected lists are the destinations, and the user isn't supposed to sort the items within the source list. Fixes angular#14838.
Adds the ability to disable sorting inside of a `CdkDropList`. This allows for use cases where one list is considered the source and one or more connected lists are the destinations, and the user isn't supposed to sort the items within the source list. Fixes #14838.
I have one case, too. If folder and files in the same CdkDropList, what can I do. |
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; } |
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 don't need connected lists. This is for connected lists. |
I think, it won't be released for angular 7. |
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
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.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!
The text was updated successfully, but these errors were encountered: