HalitTalha / ng-material-extensions

Extended features for @angular/material components
Apache License 2.0
101 stars 52 forks source link

mat-table-extensions with server side data source #34

Closed dmbarreiro closed 4 years ago

dmbarreiro commented 4 years ago

Hello, First of all thank you so much for these libraries you are contributing with, they are of great help for many of us. I'd like to know if mat-table-extensions is able to work with custom server side data sources. I have a mat-table and a paginator, to feed mat-table with data I have my own custom DataSource (implementing DataSourceinterface) for fetching data from the server when we interact with paginator. The problem is when I try to export the table mat-table-exporter goes through all the pages of my table but it outputs the data of the first page on every page. Example:

Table page 1 contains rows A, B and C Table page 2 contains row D and E

After exporting with mat-table-exporter my document has 6 rows: A, B, C, A, B, C. I've checked a bit in the source and observed even though paginator was changing page the contents of the table did not change accordingly, they stayed the same as if the table was on page 1. Am I missing something here?

I'm using:

HalitTalha commented 4 years ago

Hello @dmbarreiro, thanks for reporting this. As long as you implement DataSource interface it is supposed to work.

At first sight, I can only assume that this could be related with a breaking change inside the cdk package that's been proposed since 6.3.0. You are using a newer version of cdk however your Angular is older than this. Just to make sure could you please try with a newer version and let us know? If it still persists I have to be able to reproduce the case somehow.

If you don't like the idea of updating your Angular version, you can test this idea by trying to use Material's datasource just like in the stackblitz examples. It shouldn't work too if the version is the case.

Again thanks for your contribution :)

dmbarreiro commented 4 years ago

At the moment upgrading the project in which I was using the exporter would be a bit too much work. Instead I will try to reproduce it on a dummy project with both versions, I'll try to book some minutes for this on the weekend.

dmbarreiro commented 4 years ago

I'm still busy with this. Created the dummy project with the requested versions using one of the mat-table-exporter provided examples but still have to adapt it to make it similar to my case. Haven't forgotten about this, I'll update when I'm done.

HalitTalha commented 4 years ago

@dmbarreiro Have you got any good news for us? :)

dmbarreiro commented 4 years ago

We do not have the problem anymore with the newer version. Sorry for being irresponsive, haven't had time to reproduce it on stackblitz with the old version. From my point of view we can close the issue.

HalitTalha commented 4 years ago

Thanks for the response. Closing then.

diasandreotti commented 4 years ago

Hello, I have this problem with the most current version of the angular. Paging on the server side, in the same way that @dmbarreiro reported.