How to get row data onSelect event in ngx datatable

user3714269 picture user3714269 · Aug 21, 2018 · Viewed 14.7k times · Source

I am new to angular and ngx datatable. how to get row data on mouse click event

onClick(event) {
// I need to get row data here 
}

Answer

karan sharma picture karan sharma · Dec 31, 2018

Just use (activate)="onActivate($event)" property on ngx-datatable like this

<ngx-datatable #table
    ....
    (activate)="onActivate($event)"
    ....
>

Then in TS file, use this method

onActivate(event) {
    if(event.type == 'click') {
        console.log(event.row);
    }
}