Skip to content
This repository was archived by the owner on Jun 1, 2025. It is now read-only.

Commit 44899e2

Browse files
committed
bugfix(event): change onCellChange/onCellClick event to Keyboard/Mouse
1 parent 878e545 commit 44899e2

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

src/app/modules/angular-slickgrid/models/column.interface.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -146,10 +146,10 @@ export interface Column {
146146
name?: string;
147147

148148
/** an event that can be used for triggering an action after a cell change */
149-
onCellChange?: (e: Event, args: OnEventArgs) => void;
149+
onCellChange?: (e: KeyboardEvent | MouseEvent, args: OnEventArgs) => void;
150150

151151
/** an event that can be used for triggering an action after a cell click */
152-
onCellClick?: (e: Event, args: OnEventArgs) => void;
152+
onCellClick?: (e: KeyboardEvent | MouseEvent, args: OnEventArgs) => void;
153153

154154
/** column output type */
155155
outputType?: FieldType;

src/app/modules/angular-slickgrid/services/gridEvent.service.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { OnEventArgs, CellArgs, SlickEventHandler } from './../models/index';
1+
import { CellArgs, Column, GridOption, OnEventArgs, SlickEventHandler } from './../models/index';
22

33
// using external non-typed js libraries
44
declare var Slick: any;
@@ -17,11 +17,11 @@ export class GridEventService {
1717
/* OnCellChange Event */
1818
bindOnCellChange(grid: any, dataView: any) {
1919
// subscribe to this Slickgrid event of onCellChange
20-
this._eventHandler.subscribe(grid.onCellChange, (e: Event, args: CellArgs) => {
20+
this._eventHandler.subscribe(grid.onCellChange, (e: KeyboardEvent | MouseEvent, args: CellArgs) => {
2121
if (!e || !args || !grid || args.cell === undefined || !grid.getColumns || !grid.getDataItem) {
2222
return;
2323
}
24-
const column = grid.getColumns()[args.cell];
24+
const column: Column = grid.getColumns()[args.cell];
2525

2626
// if the column definition has a onCellChange property (a callback function), then run it
2727
if (typeof column.onCellChange === 'function') {
@@ -43,12 +43,12 @@ export class GridEventService {
4343

4444
/* OnClick Event */
4545
bindOnClick(grid: any, dataView: any) {
46-
this._eventHandler.subscribe(grid.onClick, (e: Event, args: CellArgs) => {
46+
this._eventHandler.subscribe(grid.onClick, (e: KeyboardEvent | MouseEvent, args: CellArgs) => {
4747
if (!e || !args || !grid || args.cell === undefined || !grid.getColumns || !grid.getDataItem) {
4848
return;
4949
}
50-
const column = grid && grid.getColumns && grid.getColumns()[args.cell];
51-
const gridOptions = grid && grid.getOptions && grid.getOptions() || {};
50+
const column: Column = grid && grid.getColumns && grid.getColumns()[args.cell];
51+
const gridOptions: GridOption = grid && grid.getOptions && grid.getOptions() || {};
5252

5353
// only when using autoCommitEdit, we will make the cell active (in focus) when clicked
5454
// setting the cell as active as a side effect and if autoCommitEdit is set to false then the Editors won't save correctly

0 commit comments

Comments
 (0)