Created
April 9, 2019 15:20
-
-
Save loonix/d7266ada5ff9938757b6c9227ba14d30 to your computer and use it in GitHub Desktop.
SlickGrid on cell change highlight and flash cell and apply class
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
<angular-slickgrid gridId="importGrid" [columnDefinitions]="columnDefinitions" [gridOptions]="gridOptions" | |
[dataset]="dataset" (onAngularGridCreated)="angularGridReady($event)" | |
(sgOnCellChange)="onCellChanged($event.detail.eventData, $event.detail.args)" <----- required | |
> | |
</angular-slickgrid> | |
*/ | |
onCellChanged(e, args): void { | |
this.highlightCell(args.row, args.cell, Object.keys(args.item)[args.cell]); | |
} | |
highlightCell(row, cell, colId): void { | |
(this.angularGrid.gridService as any)._grid.flashCell(row, cell, 2000); // Flashes the cell | |
const cssCellStyle = {}; | |
const classToInject = 'invalid'; | |
(cssCellStyle[row] = {})[colId] = classToInject; | |
(this.angularGrid.gridService as any)._grid.setCellCssStyles(`${classToInject}.${colId}.${row}`, cssCellStyle); // Applies the .invalid class to the cell | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment