I have an angular Material table with three fixed columns ("Type, Cod, Station") and when I start filtering the data by columns the table behaves in a wrong way, leaving a blank space between columns.
What I want is that when filtering by some column I don't get that blank space.
<table mat-table [dataSource]="dataSourceH" matSort matTableExporter #exporter="matTableExporter" #sortH="matSort" class="tr_table">
<ng-container *ngFor="let disCol of displayedColumnsH; let colIndex = index"
matColumnDef="{{disCol}}" [sticky]="isIn(disCol)">
<th mat-header-cell *matHeaderCellDef mat-sort-header>
<div [innerHTML]="displayedColumnsNamesH[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 displayedFilterColumnH; 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="Filtro" type="text"
[(ngModel)]='filterTableH[displayedColumnsH[colIndexF]]'
name="displayedColumnsH[colIndexF]"
(keyup)="hanlerOnChangeFilter($event, 'H',displayedColumnsH[colIndexF])">
<button mat-button *ngIf="filterTableH[displayedColumnsH[colIndexF]]"
(click)="handlerClearFilterField('H',displayedColumnsH[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="displayedColumnsH; sticky: true"></tr>
<tr mat-header-row *matHeaderRowDef="displayedFilterColumnH"></tr>
<tr mat-row *matRowDef="let row; columns: displayedColumnsH;"></tr>
</table>