Skip to content
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

Can't drop into same DropList in hierarchy (because DropList is filter out before call ref.connectedTo) #18450

Closed
petr-kostelansky opened this issue Feb 10, 2020 · 4 comments

Comments

@petr-kostelansky
Copy link

petr-kostelansky commented Feb 10, 2020

I have a hierarchy of items.

I would like to change order of item (Child item 3) in the same DropList (droplist of Parent item 1), just change order not move into another DropList. But I can not do that, because:
In CdkDropList is method _setupInputSyncSubscription(ref) and in this method is subscription ref.beforeStarted.subscribe(...) in which is called

            ref.connectedTo(siblings.filter((
            drop => drop && drop !== this)).map(...)

but the filter method filter out .filter(drop => drop && drop !== this) the origin DropList (this) of dragged item and than I am not able to drop back into same DropList to reorder items.


And I know that there is a method _updateActiveDropContainer(...) on DragRef that is trying to handle sorting if I dropping into same DropList but this works just for Parents. Because just if

let newContainer = this._initialContainer._getSiblingContainerFromPosition(this, x, y);

newContainer is undefined then sorting ((this._dropContainer))._sortItem(...)) can happend. But I want to drop back into DropList of children (Parent item 1) and I always get in newContainer DropList of parents and not DropList of children (Parent item 1) because the DropList of children (Parent item 1) was removed in siblings.filter((drop => drop && drop !== this)) as I mentioned above.

I can not place the item where red lines are cause the _this._initialContainer.getSiblingContainerFromPosition(this, x, y) always return DropList of children (red arrow)

or DropList of Parents (red arrow)

Can you remove for next version the filter that removes origin DropList (droplist where dragged item was placed)? Or is there some reason why the filter is there?

Environment

  • Angular: 8.2.3
  • CDK/Material: 8.1.3
  • Browser(s): Chrome Version 80.0.3987.87
  • Operating System (e.g. Windows, macOS, Ubuntu): Windows 10
@crisbeto
Copy link
Member

The filter is there, because it doesn't make sense to connect a list to itself. It sounds like you might be hitting a different issue, because the list allows dragging within itself by default.

@petr-kostelansky
Copy link
Author

The filter is there, because it doesn't make sense to connect a list to itself. It sounds like you might be hitting a different issue, because the list allows dragging within itself by default.

By default yes, but just for flat list. If the list is somewhere in hierarchy (droplist in another droplist), than the filter cause this issue.

@mmalerba mmalerba added the needs triage This issue needs to be triaged by the team label May 20, 2020
@crisbeto
Copy link
Member

Sounds like this falls into the category of "Issues with nested drop lists". Closing as a duplicate of #16671.

@crisbeto crisbeto removed the needs triage This issue needs to be triaged by the team label Jul 12, 2020
@angular-automatic-lock-bot
Copy link

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.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Aug 12, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants