changeset 28:1ceea716600f

result table can be shown with checkbox. initially hidden if > 1000 results.
author casties
date Wed, 27 Jan 2016 16:01:06 +0100
parents c2946b7135cd
children 52af480a843e
files app/query-result-table.component.ts
diffstat 1 files changed, 22 insertions(+), 17 deletions(-) [+]
line wrap: on
line diff
--- a/app/query-result-table.component.ts	Wed Jan 27 15:38:17 2016 +0100
+++ b/app/query-result-table.component.ts	Wed Jan 27 16:01:06 2016 +0100
@@ -13,23 +13,26 @@
         <pre>{{queryState.resultCypherQuery}}</pre>
         <h2>Query result</h2>
         <pre>{{resultInfo}}</pre>
-        <span *ngIf="config.paging">page {{page}} of {{numPages}}</span>
-        <pagination *ngIf="config.paging"
-                    class="pagination-sm"
-                    [(ngModel)]="page"
-                    [totalItems]="length"
-                    [itemsPerPage]="itemsPerPage"
-                    [maxSize]="maxSize"
-                    [boundaryLinks]="true"
-                    [rotate]="false"
-                    (pageChanged)="onChangeTable(config, $event)"
-                    (numPages)="numPages = $event">
-        </pagination>
-        <ngTable *ngIf="false"
-                 [config]="config.sorting"
-                 (tableChanged)="onChangeTable(config)"
-                 [rows]="rows" [columns]="columns">
-        </ngTable>
+        <div><input type="checkbox" [(ngModel)]="showTable"/> show results</div>
+        <div *ngIf="showTable">
+            <div *ngIf="config.paging">Page {{page}} of {{numPages}}</div>
+            <pagination *ngIf="config.paging"
+                        class="pagination-sm"
+                        [(ngModel)]="page"
+                        [totalItems]="length"
+                        [itemsPerPage]="itemsPerPage"
+                        [maxSize]="maxSize"
+                        [boundaryLinks]="true"
+                        [rotate]="false"
+                        (pageChanged)="onChangeTable(config, $event)"
+                        (numPages)="numPages = $event">
+            </pagination>
+            <ngTable 
+                     [config]="config.sorting"
+                     (tableChanged)="onChangeTable(config)"
+                     [rows]="rows" [columns]="columns">
+            </ngTable>
+        </div>
     </div>
         `,
     inputs: ['queryState', 'resultInfo'],
@@ -41,6 +44,7 @@
     public queryState: QueryState;
     public resultInfo: string;
     
+    public showTable = false;
     public data: Array<any>;
     public columns: Array<any>;
     
@@ -63,6 +67,7 @@
         this.data = this.queryState.results;
         this.columns = this.queryState.resultColumns;
         this.config.sorting = this.queryState.resultColumns;
+        this.showTable = (this.data.length < 1000);
         this.onChangeTable(this.config, null);
     }