blob: c9763772df5522f53070ef9f10cb377f93ccc997 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
|
import { Component, OnInit, Input, ChangeDetectionStrategy } from '@angular/core';
@Component({
selector: 'app-sql-validate-success-dialog-component',
templateUrl: './sql-validate-success-dialog.component.html',
styleUrls: ['./sql-validate-success-dialog.component.css'],
changeDetection: ChangeDetectionStrategy.OnPush
})
export class SQLValidateSuccessDialogComponent implements OnInit {
@Input('tableObj') tableObj : any;
headers = [];
rows = [];
finalDisplayObjArr : any[] = new Array();
subArr : string[] = new Array();
constructor() { }
ngOnInit() {
}
ngOnChanges(){
//console.log(this.tableObj);
this.rows = new Array();
this.headers = new Array();
this.finalDisplayObjArr = new Array();
this.tableObj = this.tableObj;
this.headers = JSON.parse(this.tableObj)["reportDataColumns"];
this.rows = JSON.parse(this.tableObj)["reportDataRows"];
// for(let i=0; i<this.headers.length; i++)
// {
// this.subArr.push(this.headers[i]);
// }
// this.finalDisplayObjArr.push(this.subArr);
for(let i=0; i<this.rows.length; i++)
{
this.subArr = [];
for(let j=0; j<this.headers.length; j++)
{
//console.log(this.rows[i][this.headers[j]]);
this.subArr.push(this.rows[i][this.headers[j]]);
}
// console.log(this.subArr);
this.finalDisplayObjArr.push(this.subArr);
}
console.log(this.finalDisplayObjArr);
}
}
|