init order

This commit is contained in:
_Bastler 2021-12-15 13:25:10 +01:00
parent 71f6a352f1
commit 572a1c8a45
3 changed files with 54 additions and 57 deletions

View File

@ -1,4 +1,5 @@
<table mat-table matSort [dataSource]="permissions" (matSortChange)="sortData($event)"> <table mat-table matSort [dataSource]="permissions" (matSortChange)="sortData($event)" matSortActive="name"
matSortDirection="asc">
<ng-container matColumnDef="name"> <ng-container matColumnDef="name">
<th mat-header-cell *matHeaderCellDef mat-sort-header="name"> {{'permissions.name' | i18n}} </th> <th mat-header-cell *matHeaderCellDef mat-sort-header="name"> {{'permissions.name' | i18n}} </th>
<td mat-cell *matCellDef="let permission"> <td mat-cell *matCellDef="let permission">

View File

@ -1,4 +1,4 @@
import {Component, OnInit, Input, SimpleChanges, OnChanges} from '@angular/core'; import {Component, OnInit, Input} from '@angular/core';
import {Sort} from '@angular/material/sort'; import {Sort} from '@angular/material/sort';
import {I18nService} from './../../services/i18n.service'; import {I18nService} from './../../services/i18n.service';
@ -7,7 +7,7 @@ import {I18nService} from './../../services/i18n.service';
templateUrl: './permissions.component.html', templateUrl: './permissions.component.html',
styleUrls: ['./permissions.component.scss'] styleUrls: ['./permissions.component.scss']
}) })
export class PermissionsComponent implements OnInit, OnChanges { export class PermissionsComponent implements OnInit {
datetimeformat: String; datetimeformat: String;
@Input() permissions; @Input() permissions;
@ -20,10 +20,6 @@ export class PermissionsComponent implements OnInit, OnChanges {
this.datetimeformat = this.i18n.get('format.datetime', []); this.datetimeformat = this.i18n.get('format.datetime', []);
} }
ngOnChanges(changes: SimpleChanges): void {
this.sortData({ "active": "name", "direction": "asc" });
}
sortData(sort: Sort) { sortData(sort: Sort) {
const data = this.permissions.slice(); const data = this.permissions.slice();
if(!sort.active || sort.direction === '') { if(!sort.active || sort.direction === '') {

View File

@ -1,5 +1,5 @@
<table mat-table matSort [dataSource]="quotas" (matSortChange)="sortData($event)"> <table mat-table matSort [dataSource]="quotas" (matSortChange)="sortData($event)" matSortActive="name"
matSortDirection="asc">
<ng-container matColumnDef="name"> <ng-container matColumnDef="name">
<th mat-header-cell *matHeaderCellDef mat-sort-header="name"> {{'quotas.name' | i18n}} </th> <th mat-header-cell *matHeaderCellDef mat-sort-header="name"> {{'quotas.name' | i18n}} </th>
<td mat-cell *matCellDef="let quota"> <td mat-cell *matCellDef="let quota">
@ -14,8 +14,8 @@
</ng-container> </ng-container>
<ng-container matColumnDef="fixed_value"> <ng-container matColumnDef="fixed_value">
<th mat-header-cell *matHeaderCellDef> {{'quotas.fixed_value' | i18n}} <mat-icon <th mat-header-cell *matHeaderCellDef> {{'quotas.fixed_value' | i18n}} <mat-icon #primaryHint="matTooltip" inline
#primaryHint="matTooltip" inline matTooltip="{{'quotas.fixed_value.hint' | i18n}}">info</mat-icon> matTooltip="{{'quotas.fixed_value.hint' | i18n}}">info</mat-icon>
</th> </th>
<td mat-cell *matCellDef="let quota"><span *ngIf="!quota.disposable">{{quota.value}}</span> </td> <td mat-cell *matCellDef="let quota"><span *ngIf="!quota.disposable">{{quota.value}}</span> </td>
</ng-container> </ng-container>