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
feat(cdkDropList): Add configuration input to prevent list rearranging #14027
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
Add an input property to cdkDropList directive that prevents the draggable elements within it from rearranging. For example: @Input() preventRearrange: boolean = false
What is the expected behavior?
When preventRearrange is set to true the other elements within the drop list would remain in the initial position while the user is dragging an element. When set to false, cdkDropList would behave as it does now.
What is the current behavior?
There is currently no way to prevent list items from rearranging
What is the use-case or motivation for changing an existing behavior?
This is useful for features in which the user is expected to move items between lists, but the order is determined by sources other than the user. For example, if two lists are supposed to remain in alphabetical order, but users can move items from one list to the other.
This would also make it easier to develop features where the item being dragged is not removed from the source list. For example, a tool pallet that allows for the dragging and dropping of the same item multiple times.
Which versions of Angular, Material, OS, TypeScript, browsers are affected?
This is also useful for dragging from an area that the draggable items span multiple rows/columns. currently it just behaves terribly because reordering only supports either row or column, not grids, etc.
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
dpsthree commentedon Nov 7, 2018
Alternatively, the implementation of arbitrary from/to without a dropList could also solve this problem.
princemaple commentedon Jan 27, 2019
This is also useful for dragging from an area that the draggable items span multiple rows/columns. currently it just behaves terribly because reordering only supports either row or column, not grids, etc.
princemaple commentedon Feb 24, 2019
@crisbeto looks like this one can be closed since your #15064 is in.
crisbeto commentedon Feb 24, 2019
Thanks for the heads-up. Closing.
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.