How to handle double click (dblclick) event on row with data in kendo-grid in Angular2?

322 Views Asked by At

I'm using Angular2 & TS withkendo-grid and it allows to get the data of the clicked row, but only for

singleClick => (cellClick)="onCellClick($event.dataItem)"

, not doubleClick => (dblclick)="onDblClick(<<CANNOT_GET_ROW_DATA_HERE>>)

How to an event on dblclick, not cellClick, but with exact row we want?

1

There are 1 best solutions below

0
On

It's very simple.

You've just got to add both event listeners to your <kendo-grid> options.

    <kendo-grid
                (cellClick)="onCellClick($event.dataItem)"
                (dblclick)="onDblClick()">

and then in your controller:

  1. Add a new global field:

class MyClass { clickedRowItem: myObject; ..... }

  1. Assign the value from cellClick to this field:

onCellClick(dataItem: myObject) { this.clickedRowItem = trackerId; }

  1. Run the dblFunction with the field as the argument:

onDblClick() { this.myFunctionToFire(this.clickedRowItem); }