Reputation: 617
Is it possible to drag my own component into a Kendo UI for Angular 2 Sortable? Basically, I'd like to drag items from one part of the page and have them added to a kendo-sortable, but not have them removed from where it was dragged from.
Upvotes: 0
Views: 292
Reputation: 501
Yep, it is possible. And there are 2 ways to do it.
The more complex one is implementing your SortableService. That works with SortableComponent and your Component and do exactly what you need.
Second solution is simple: Wrap your component inside a Sortable, even if it has only one item. Lets say you have SortableA with your original component inside. And SortableB - the target where you will drop the items.
Set [zone]="zone1"
for SortableA, and [acceptZones] = "zone1"
for SortableB.
At this point you will be able to drag the single item from SortableA to SortableB.
The last thing is to call preventDefault in the dataRemove event of SortableA. This will make SortableA copy items upon drop, instead of moving them.
Upvotes: 2