Suppose I'm sorting the header by name so how can I send this header in the api for server side sorting
Asked
Active
Viewed 64 times
0
-
1if you're using mat-table and mat-sort, you has the property "active" and "direction". If you want to see an example of API with a mat-table see this [SO](https://stackoverflow.com/questions/63780213/connect-method-datasource-is-not-emitting-all-paginated-rows-for-mattable/63783274#63783274), in the comments there're a full example (well, the example has also filter and paginator, you can get only the part of sort) – Eliseo Jan 11 '22 at 07:29
-
but I have a form which contains some filters based on those I need to display the records and do the server side sorting and pagination it is not working in ngAfterViewInit. – NAR Jan 11 '22 at 11:30
-
Nar, take account that before use the "sort" you need that was in the view, so if you has under a *ngIf you need make a "work-aroud", see this [SO](https://stackoverflow.com/questions/63776332/why-angular-table-didnt-sort/63783888#63783888). So before call your API you need know is the "header" is visible to get the "mat-sort – Eliseo Jan 11 '22 at 11:52
-
Please clarify your specific problem or provide additional details to highlight exactly what you need. As it's currently written, it's hard to tell exactly what you're asking. – Community Jan 18 '22 at 20:40