Fix loading in table

master
Max Ehrlicher-Schmidt 4 years ago
parent 1a50021c0e
commit 4ef5d93c4f

@ -20,7 +20,7 @@
class="table-control-button" class="table-control-button"
matTooltip="Tabllendaten aktualisieren. Achtung! Alle ungespeicherten Änderungen gehen verloren." matTooltip="Tabllendaten aktualisieren. Achtung! Alle ungespeicherten Änderungen gehen verloren."
(click)="reloadTable()" (click)="reloadTable()"
[disabled]="reloadingTable" [disabled]="reloadingTable || !isLoaded"
> >
<mat-icon class="spin">sync</mat-icon> <mat-icon class="spin">sync</mat-icon>
</button> </button>
@ -76,7 +76,7 @@
cdkDropListOrientation="horizontal" cdkDropListOrientation="horizontal"
(cdkDropListDropped)="drop($event)" (cdkDropListDropped)="drop($event)"
[dataSource]="data" [dataSource]="data"
[ngClass]="{ 'idle-overlay': !isLoaded }" [ngClass]="{ 'idle-overlay': !isLoaded || reloadingTable }"
> >
<!--- Note that these columns can be defined in any order. <!--- Note that these columns can be defined in any order.
The actual rendered columns are set as a property on the row definition" --> The actual rendered columns are set as a property on the row definition" -->
@ -383,7 +383,7 @@
> >
<mat-spinner <mat-spinner
class="idle-spinner" class="idle-spinner"
*ngIf="!isLoaded || isProcessing" *ngIf="!isLoaded || isProcessing || reloadingTable"
[diameter]="48" [diameter]="48"
></mat-spinner> ></mat-spinner>
</div> </div>

@ -164,14 +164,14 @@ export class TableComponent implements AfterViewInit {
this.dataService.tableData.subscribe((newTableDataSource) => { this.dataService.tableData.subscribe((newTableDataSource) => {
const tempDataSource = []; const tempDataSource = [];
this.isLoaded = true;
this.reloadingTable = false;
this.loadingErrorOccurred = false;
if (newTableDataSource == null) { if (newTableDataSource == null) {
this.data.data = []; this.data.data = [];
this.loadingErrorOccurred = true; this.loadingErrorOccurred = false;
return; return;
} }
this.isLoaded = true;
this.reloadingTable = false;
this.loadingErrorOccurred = false;
for (const row of newTableDataSource) { for (const row of newTableDataSource) {
if (row.newObject) { if (row.newObject) {
// its a copied object // its a copied object

Loading…
Cancel
Save