SortableJS / ngx-sortablejs

Angular 2+ binding to SortableJS. Previously known as angular-sortablejs
https://sortablejs.github.io/ngx-sortablejs/
MIT License
467 stars 160 forks source link

How to access source(from) and target(to) item list on callback #194

Open Amitesh opened 4 years ago

Amitesh commented 4 years ago

Hi,

Thank you for wonderful library.

I was trying to implement it in one of learning POC with multi-list drag&drop application like JIRA board. I was trying to access the source(from) and target(to) item list on onAdd(), onRemove() options callback. It is only giving the oldindex and newindex to me. My lists are with parent component and each list is reside in individual component. Current list(dropped list) is not aware about the source of the new item. I need to apply business logic through RESTful apis on server.

Can you suggest, how i can access it?

I have gone through the event interface which has no info about the to-from lists.

interface SortableEvent {
  oldIndex: number;
  newIndex: number;
  oldDraggableIndex?: number;
  newDraggableIndex?: number;
  item: HTMLElement;
  clone: HTMLElement;
}

Thanks.

joelcoxokc commented 3 years ago

Any updates on this...

I need access to the item that was moved or cloned. unfortunately the library only passes raw HTMLElements to the onAdd and onRemove is there any way to pass the added or removed data along with the method?

tehZeno commented 2 years ago

+1 but it seems no-one is maintaining this?