Is there a way for me to keep the last four rows fixed when sorting the table based on the column header? Here is an image of the table: table image
<table mat-table [dataSource]="dataSourceMD" matSort (matSortChange)="getRowMaximoTable('dataSourceMD', 'indexMaximoMD')" matTableExporter #exporter="matTableExporter" #sortMD="matSort" class="tr_table">
<ng-container *ngFor="let disCol of displayedColumnsMD; let colIndex = index"
matColumnDef="{{disCol}}" [sticky]="isIn(disCol)">
<th mat-header-cell *matHeaderCellDef mat-sort-header>
<div [innerHTML]="displayedColumnsNamesMD[colIndex]"></div>
</th>
<td mat-cell *matCellDef="let element" [style.background-color]="element[disCol+'Color']" [style.color]="element[disCol+'Texto']">
<div *ngIf="element[disCol]" [innerHTML]="element[disCol]"></div>
<div *ngIf="!element[disCol] && !isIn(disCol)" [innerHTML]="'-'"></div>
</td>
</ng-container>
<ng-container *ngFor="let filCol of displayedFilterColumnMD; let colIndexF = index"
matColumnDef="{{filCol}}" [sticky]="colIndexF<3">
<th mat-header-cell *matHeaderCellDef [style.text-align]="center" [attr.colspan]="1">
<mat-form-field class="columnas" floatLabel='never'>
<input matInput placeholder="Filter" type="text"
[(ngModel)]='filterTableMD[displayedColumnsMD[colIndexF]]'
name="displayedColumnsMD[colIndexF]"
(keyup)="hanlerOnChangeFilter($event, 'MD',displayedColumnsMD[colIndexF])">
<button mat-button *ngIf="filterTableMD[displayedColumnsMD[colIndexF]]"
(click)="handlerClearFilterField('MD',displayedColumnsMD[colIndexF])" matSuffix
mat-icon-button aria-label="Clear">
<mat-icon class="material-icons-outlined">close</mat-icon>
</button>
</mat-form-field>
</th>
</ng-container>
<tr mat-header-row *matHeaderRowDef="displayedColumnsMD; sticky: true"></tr>
<tr mat-header-row *matHeaderRowDef="displayedFilterColumnMD"></tr>
<tr mat-row [ngClass]="{ 'maximo-row': i == indexMaximoMD }" *matRowDef="let row; columns: displayedColumnsMD; let i = index"></tr>
</table>
How can I make sure that the last four rows in this Angular Material table stay fixed even when sorting using the matSort attribute?