On Events

See the full list of Available Events which you can use by simply hook a subscribe to them (the subscribe are a custom SlickGrid Event and are NOT an RxJS Observable type but they very similar). You can access them in Slickgrid-Universal by following the documentation below

View

<angular-slickgrid
     gridId="grid2"
     [columns]="columnDefinitions"
     [options]="gridOptions"
     [dataset]="dataset"
     (onAngularGridCreated)="angularGridReady($event.detail)"
     (onCellChange)="onCellChanged($event.detail.eventData, $event.detail.args)"
     (onClick)="onCellClicked($event.detail.eventData, $event.detail.args)">
</angular-slickgrid>

Component

Hook yourself to the Changed event of the bindable grid object.

export class GridEditorComponent {
  angularGridReady(angularGrid: AngularGridInstance) {
    this.angularGrid = angularGrid;

    // the Angular Grid Instance exposes both Slick Grid & DataView objects
    this.gridObj = angularGrid.slickGrid;
    this.dataViewObj = angularGrid.dataView;

    // it also exposes all the Services
    // this.angularGrid.resizerService.resizeGrid(10);
  }

  onCellChanged(e, args) {
    this.updatedObject = args.item;
    this.angularGrid.resizerService.resizeGrid(10);
  }

  onCellClicked(e, args) {
    // do something
  }
}

Example with Custom Event

Angular-Slickgrid can trigger the following custom events that you can hook to. However please note that onDataviewCreated and onGridCreated are a lot less used now since onAngularGridCreated now exposes both the Slick Grid & DataView objects.

  • onAngularGridCreated

  • onDataviewCreated

  • onGridCreated

  • onBeforeGridCreate

  • onBeforeGridDestroy

  • onAfterGridDestroyed

View

Bind (onDataviewCreated) and (onGridCreated) if you want to call any SlickGrid legacy functions.

Component

Once the Grid and DataView are ready, you can subscribe to any Available Events and don't forget to unsubscribe to avoid unwanted behaviors and memory leak when your component is destroyed. See below for the gridReady(grid) and dataviewReady(dataview) functions.

  • The example shown below is subscribing to onClick and ask the user to confirm a delete, then will delete it from the DataView.

  • Technically, the Grid and DataView are created at the same time by Angular-Slickgrid, so it's ok to call the dataViewObj within some code of the gridReady() function since DataView object will already be available at that time.

Example with (onAngularGridCreated)

Angular-Slickgrid now also expose the Slick Grid and DataView objects through the (onAngularGridCreated) event, for example:

View

Component

Last updated