-1

I need to display data in a angular Mat data table that are coming from the API.

Before showing it, I want to filter 3 data records and display the top ones.

As an example data = [ ['Admin user', '12'], ['Test User ', '2'], ['System user', '5'], ['Default user ', '66'], ['Jane user', '77'], ['Thomas', '77'] ] From the above array, I need to show the system user first and then the default user and then the rest. How can I do that

The output should be in the following order

A header Another header
System User 5
Default User 66
Jane User 77
Admin user 77

.. after rest

Kasun D
  • 1
  • 1

1 Answers1

0

It seems you want to sort on "another header"?

You should provide a name on that header cell.

 <mat-header-cell mat-sort-header="YOUR_NAME">

On mat-table tag you can provide a default header column like this

<mat-table matSortActive="YOUR_NAME" matSort>

For more info & examples: https://material.angular.io/components/sort/overview