0
votes

I am trying to implement drag&drop functionality on ngx-datatable rows.

As mentioned in this open request on Github https://github.com/swimlane/ngx-datatable/issues/411, there is a custom directive I can add to achieve this. However, all the plunkers provided show multiple issues in the console when I tried to open them.

I've created a working sample here https://codesandbox.io/s/121n85o33, but the feature is not working properly. If you play around, you can see the rows are dropped without order. It will be great if someone can point me in the right direction to fix the problem.

1
Hey @Ardenne, Have you found a solution. Please let me in if you have. Thanks in advance.Torab Shaikh
Hi @TorabShaikh. Unfortunately, I stopped working on this issue a couple of months ago. I think someone else is working on it on the GitHub page. You should try there.Ardenne

1 Answers

1
votes

Just remove the slice call in onDrop in your AppComponent.ts :

onDrop(event) {
  console.log("onDrop", event);
  // ngx-datatable recommends you force change detection
  //let newData = event.slice();

  // OR let this.data = [...event]
  this.rows = event;
  console.log("update", this.rows);
}