ghiscoding / Angular-Slickgrid

Angular-Slickgrid is a wrapper of the lightning fast & customizable SlickGrid datagrid, it also includes multiple Styling Themes
https://ghiscoding.github.io/Angular-Slickgrid
MIT License
397 stars 120 forks source link

How to use Slick.RowMoveManager for drag and drop #78

Closed VedNirmal closed 5 years ago

VedNirmal commented 5 years ago

I'm submitting a bug report I'm submitting a feature request

Please tell us about your environment:

Current behavior: I'm using Angular-SlickGrid and trying to implement the drag and drop feature. I referred following URL to implement the same. https://mleibman.github.io/SlickGrid/examples/example9-row-reordering.htmI

I was trying to use below code snippet : this.gridObj.setSelectionModel(new Slick.RowSelectionModel()); var moveRowsPlugin = new Slick.RowMoveManager(); self.gridObj.registerPlugin(moveRowsPlugin);

Not able to use RowMoveManager as type script defination is not available. Please help me on this issue.

Expected/desired behavior:

ghiscoding commented 5 years ago

You should be able to use it, I don't have any examples made for this plugin but the plugin file is imported here. So technically, all you need is a reference to the grid instance, you can see Wiki - SlickGrid Object and then use it. You don't always need TypeScript, my lib added a lot of type definitions but SlickGrid itself has none, that didn't stop me from building the lib.

Quick code out of my head

declare var Slick: any;

export class MyExample {
  gridObj: any;
  moveRowsPlugin: any;

  angularGridReady(angularGrid: any) {
    this.angularGrid = angularGrid;
    this.gridObj = angularGrid.slickGrid;

    this.gridObj.setSelectionModel(new Slick.RowSelectionModel());
    this.moveRowsPlugin = new Slick.RowMoveManager({
      cancelEditOnDrag: true
    });
    this.gridObj.registerPlugin(moveRowsPlugin);
}
VedNirmal commented 5 years ago

Thanks much!! It really helped me. Appreciated.

ghiscoding commented 5 years ago

Reopening as I will push a new version sometime this week that will add this plugin and an example.

ghiscoding commented 5 years ago

@VedNirmal A new Example 17 now shows the Row Move Manager Plugin. This was released under NPM version 1.8.0, so go try it out

Also if you like the lib, you can also up vote ⭐️ Cheers