question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

NzTableComponent should support CDK Datasource

See original GitHub issue

What problem does this feature solve?

NzTableComponent will be able to support virtual scrolling of unknown size data sources. Currently, unlike NzListComponent, the table component supports only a static array as input, even for virtual scrolling. This limits the table capabilities, as it uses the Angular CDK virtual scroll viewport, which supports a Datasource implementation natively (@angular/cdk/collections).

https://github.com/NG-ZORRO/ng-zorro-antd/blob/f7fd1e92e4a3b38af13afafe6c0fd7aa5e0dfbbb/components/table/nz-table.component.html#L50

Custom solutions do indeed work. However they work poorly, especially in respect to change detection and scrolling behavior.

What does the proposed API look like?

NzTableComponent should accept nzData: T[] | Datasource<T>;.

Issue Analytics

  • State:open
  • Created 4 years ago
  • Comments:15 (13 by maintainers)

github_iconTop GitHub Comments

1reaction
vthinkxiecommented, Jul 11, 2019

@lppedd thanks to your efforts! we will check it later

1reaction
lppeddcommented, Jul 10, 2019

I’m now working on this full-time at work.
I’m battling with, apparently, a change-detection issue, caused by the multiple templates nesting & the CdkVirtualForOf directive itself.
The view is constantly re-rendered, causing an odd infinite-automatic-scroll behavior.

The only solution seems to be detaching from change-detection and detectChanges manually on scrolling, e.g.

this.cdkVirtualScrollViewport
  .elementScrolled()
  .subscribe({ next: () => this.cdr.detectChanges() });

Alternatively, the cdk-virtual-scroll-viewport must be placed under a non-conditional template (tbc).

Read more comments on GitHub >

github_iconTop Results From Across the Web

ng-zorro/ng-zorro-antd - Gitter
Hello Devs, Can anyone tell me how to implement the searching in Tree Select , The tree nodes are in async loading ....
Read more >
Table | Angular Material
The CdkTable is an unopinionated, customizable data-table with a fully-templated API, dynamic columns, and an accessible DOM structure.
Read more >
Table | NG-ZORRO - Ant Design
Virtual scrolling combine with cdk scrolling used to display large data, you can get cdkVirtualScrollViewport in NzTableComponent and find more API here.
Read more >
Angular Table CDK with remote source - Stack Overflow
I am trying to figure out how to populate my table data source ... The table will only update when * the returned...
Read more >
Angular CDK Tables - Medium
This tableDataSource$ will serve as our DataSource input for our Angular CDK ... (dragenter) / (dragend) to support dragging and dropping in your...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found