Mercurial > hg > ng2-query-ismi
comparison app/query-result-table.component.ts @ 24:f6f4177d0a81
use ng2-table for results.
author | casties |
---|---|
date | Tue, 26 Jan 2016 16:54:38 +0100 |
parents | |
children | 0795207f3b90 |
comparison
equal
deleted
inserted
replaced
23:f7a7014abf5c | 24:f6f4177d0a81 |
---|---|
1 import {Component, OnInit} from 'angular2/core'; | |
2 | |
3 import {NG_TABLE_DIRECTIVES} from 'ng2-table/ng2-table'; | |
4 | |
5 import {QueryState} from './query-state'; | |
6 | |
7 @Component({ | |
8 selector: 'query-result-table', | |
9 template: ` | |
10 <div *ngIf="queryState && queryState.results"> | |
11 <pre>{{queryState.resultCypherQuery}}</pre> | |
12 <p>Query results ({{queryState.resultInfo}}):</p> | |
13 <ngTable | |
14 (tableChanged)="onChangeTable(config)" | |
15 [rows]="queryState.results" [columns]="queryState.resultColumns"> | |
16 </ngTable> | |
17 </div> | |
18 `, | |
19 inputs: ['queryState'], | |
20 directives: [NG_TABLE_DIRECTIVES] | |
21 }) | |
22 | |
23 export class QueryResultTableComponent implements OnInit { | |
24 | |
25 public queryState: QueryState; | |
26 | |
27 ngOnChanges() { | |
28 console.debug("result table changed! queryState=", this.queryState?this.queryState.resultColumns:''); | |
29 } | |
30 | |
31 ngOnInit() { | |
32 this.setup(); | |
33 } | |
34 | |
35 setup() { | |
36 console.debug("result table init!"); | |
37 } | |
38 | |
39 } |