Skip to content

feat(cdkDropList): Add configuration input to prevent list rearranging #14027

Closed

Description

@dpsthree

Bug, feature request, or proposal:

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?

7+

Activity

  1. dpsthree commented on Nov 7, 2018

    @dpsthree
    Author

    Alternatively, the implementation of arbitrary from/to without a dropList could also solve this problem.

  2. added
    feature
    P3
    on Nov 8, 2018
  3. princemaple commented on Jan 27, 2019

    @princemaple
    Contributor

    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.

  4. princemaple commented on Feb 24, 2019

    @princemaple
    Contributor

    @crisbeto looks like this one can be closed since your #15064 is in.

  5. crisbeto commented on Feb 24, 2019

    @crisbeto
    Member

    Thanks for the heads-up. Closing.

  6. angular-automatic-lock-bot commented on Sep 10, 2019

    @angular-automatic-lock-bot

    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.

  7. locked and limited conversation to collaborators on Sep 10, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

P3feature

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions