1 import { Component, OnInit, ViewChild } from '@angular/core';
2 import { ActivatedRoute, Router } from '@angular/router';
3 import { DisplayAreaService } from 'src/app/shared/services/displayArea/display-area.service';
4 import { MatPaginator } from '@angular/material/paginator';
5 import { MatSort } from '@angular/material/sort';
6 import { MatTable, MatTableDataSource } from '@angular/material/table';
9 selector: 'app-display-area',
10 templateUrl: './display-area.component.html',
11 styleUrls: ['./display-area.component.scss']
13 export class DisplayAreaComponent implements OnInit {
15 @ViewChild( MatPaginator, { static: false } as any ) paginator: MatPaginator;
16 @ViewChild( MatSort, { static: false } as any ) sort: MatSort;
17 @ViewChild( MatTable, { static: false } as any ) table: MatTable<any>;
21 displayedColumns = ["reportName", "reportDescr","reportURL"];
27 constructor(private _route: ActivatedRoute, private _router: Router, private _displayAreaService: DisplayAreaService) { }
30 this._route.params.subscribe(params => {
31 this.menuId = params['menuId'];
32 console.log("displayArea " +this.menuId);
33 this.initializeReportList(this.menuId);
40 initializeReportList(menuId:string) {
41 this.showSpinner = true;
42 this.dataSource1 = new MatTableDataSource();
43 this.finalGETObj = new Object();
44 //this.finalGETObjRowsArr = new Array();
45 this.finalRowArr = new Array();
46 this._displayAreaService.getMenuIdSpecificReports(this.menuId)
47 .subscribe(( responseObj ) => {
48 this.finalGETObj = responseObj;
49 for (let entry of responseObj) {
50 this.rowObj = new Object();
51 this.rowObj["reportName"] = entry["reportName"];
52 this.rowObj["reportDescr"] = entry["reportDescr"];
53 this.rowObj["reportURL"] = entry["reportURL"];
54 this.finalRowArr.push( this.rowObj );
56 this.showSpinner = false;
60 runReport( reportId: string ) {
61 this.reportId = reportId;
62 this._router.navigate( [reportId] );