Skip to content

[drag-drop] allow changing the element of a DropListRef #15086

Closed
@shlomiassaf

Description

@shlomiassaf

Please describe the feature you would like to request.

Allow changing element in DropListRef, similar to how it is done in DragRef

What is the use-case or motivation for this proposal?

Currently, in DragRef we can use withRootElement() to change the element, host of the dragged item. In DropListRef this is not the case, the element is readonly and can not change.

There are scenarios where the element we want to for the container is not reachable, mostly when it is in a component.

<cdk-table cdkDropList></cdk-table>

Now if we want to to have a specific element inside the table to act as the drop container we cant...

I've already raised a somewhat similar issue with the proposal to add an @Input() to cdkDropList but the main concern was exposing an input on the directive for this specific use case that will have to be maintained...

Now that we have a service, one might choose to implement this feature (or not) in his own directive.

E.g.: Use an @Input() that accepts a query selector string and replace the element based on that.

I don't see any reason why we can't change it (maybe there is?). It does not have any event registered so it should be quite simple...

Metadata

Metadata

Assignees

Labels

P4A relatively minor issue that is not relevant to core functionsfeatureThis issue represents a new feature or feature request rather than a bug or bug fix

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions