[SI-1939] initial sorting
Signed-off-by: Peter Buschmann <peter.buschmann@pta.de>
diff --git a/projects/grid-failure-information-table-app/src/app/app.component.html b/projects/grid-failure-information-table-app/src/app/app.component.html
index dd8f586..4a3b2f1 100644
--- a/projects/grid-failure-information-table-app/src/app/app.component.html
+++ b/projects/grid-failure-information-table-app/src/app/app.component.html
@@ -19,6 +19,7 @@
[rowData]="gridFailures$ | async"
[overlayNoRowsTemplate]="noRowsTemplate"
[columnDefs]="columnDefs"
+ (gridReady)="onGridReady($event)"
>
</ag-grid-angular>
<app-spinner [isRunning]="!(gridFailures$ | async)"></app-spinner>
diff --git a/projects/grid-failure-information-table-app/src/app/app.component.ts b/projects/grid-failure-information-table-app/src/app/app.component.ts
index 06ed7a0..ad17ad2 100644
--- a/projects/grid-failure-information-table-app/src/app/app.component.ts
+++ b/projects/grid-failure-information-table-app/src/app/app.component.ts
@@ -29,6 +29,8 @@
public defaultColDef: any;
public gridOptions: GridOptions;
public noRowsTemplate: string;
+ private _gridApi;
+ private _gridColumnApi;
constructor(private _appTableService: AppTableService) {
this.defaultColDef = {
@@ -44,4 +46,11 @@
localeText: Globals.LOCALE_TEXT,
};
}
+
+ onGridReady(params): void {
+ this._gridApi = params.api;
+ this._gridColumnApi = params.columnApi;
+ const sortModel = [{ colId: 'failureBegin', sort: 'desc' }];
+ this._gridApi.setSortModel(sortModel);
+ }
}