swimlane / ngx-datatable

✨ A feature-rich yet lightweight data-table crafted for Angular
http://swimlane.github.io/ngx-datatable/
MIT License
4.63k stars 1.68k forks source link

onActive triggered multiple times in IE and Edge #558

Open webmatrixxxl opened 7 years ago

webmatrixxxl commented 7 years ago

I'm submitting a ... (check one with "x")

[x] bug report => search github for a similar issue or PR before submitting
[ ] feature request
[ ] support request => Please do not submit support request here

Current behavior onActive() triggered multiple times in IE and Edge https://infinit.io/_/3c5uZZJ

event parameter is undefined

private onActivate(event) {
 console.log(event)
 console.log(..)
}

Expected behavior It should be triggered only once.

Reproduction of the problem Just log soothing in onActive function

Please tell us about your environment:

amcdnl commented 7 years ago

Oh lovely IE.

dae721 commented 7 years ago

Just ran into this one myself. Looks like IE and Edge support an activate event that Chrome does not. The normal reference sites mdn and w3schools don't have much on this, but see http://help.dottoro.com/ljqrtxvj.php. Click preview on example 1 - works in Edge, not Chrome.

Each ngx-datatable component that binds to the event, e.g. (activate)="onActivate($event, ii)" in body-row.component fires a UIEvent in IE and Edge. Easy workaround is to ignore it if event is undefined on the parameter.

igghera commented 6 years ago

I had the same issue and fixed it with @dae721 's workaround. In my case I was looking for $event.row which was undefined. I just ignored all the cases where typeof $event.row === 'undefined' and that was it