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, post on Stackoverflow or Gitter
Current behavior
If you have datatable with scroll and selection enabled and if you scroll down, you can't select a row.
Expected behavior
You should be able to select a row even if you use scrolling.
Reproduction of the problem
http://plnkr.co/edit/Uld4HKYkm0jiTJl5u7j1?p=preview
What is the motivation / use case for changing the behavior?
Please tell us about your environment:
Table version: 11.0.5 - 11.1.7
Angular version: 5.1.1
Browser: [all | Chrome XX | Firefox XX | IE XX | Safari XX | Mobile Chrome XX | Android X.X Web Browser | iOS XX Safari | iOS XX UIWebView | iOS XX WKWebView ]
Language: [all | TypeScript X.X | ES6/7 | ES5]
Think this is the same as my issue (https://github.com/swimlane/ngx-datatable/issues/1223) - something with zones, at least.
@yusijs using zone.run() doesn't fixed the issue for me. Maybe it's because I have issue with selection itself.
I've moved to row selections as well, and using zones works fine for me.
However, it doesn't highlight the selection - perhaps it's the same for you?
It seems related, nonetheless - to me it seems like the datatable detaches itself from angular when scrolling, and never reattaches itself. However that's just a wild guess.
Zone can help in this way:
public onSelect({ selected }): void {
this.zone.run(() => {
this.selected.splice(0, this.selected.length);
this.selected.push(...selected);
});
}
The zone issues might be related to this root cause:
https://github.com/swimlane/ngx-datatable/issues/1321#issuecomment-378011326
If anyone is interested to use a version with scrolling running in zone, you can replace your package.json:
"@swimlane/ngx-datatable": "semanticresearch/ngx-datatable#scroll-in-zone",
The only difference from release v13 is making scrolling happen inside zone:
https://github.com/semanticresearch/ngx-datatable/commits/scroll-in-zone
@marjan-georgiev, I believe this should be fixed and can be closed with #1375 which was just merged.
Most helpful comment
Zone can help in this way: