Mercurial > hg > ng2-query-ismi
changeset 52:738e90238443 ng2-table
ng2-table version mostly works (without page-n-of-m, problems with columns).
author | casties |
---|---|
date | Thu, 23 Mar 2017 13:41:30 +0100 |
parents | 1245781e2575 |
children | ac4bfbd99638 |
files | package.json src/app/query-app.module.ts src/app/query-result-table.component.ts src/systemjs.config.js |
diffstat | 4 files changed, 21 insertions(+), 14 deletions(-) [+] |
line wrap: on
line diff
--- a/package.json Thu Mar 23 11:04:48 2017 +0100 +++ b/package.json Thu Mar 23 13:41:30 2017 +0100 @@ -1,6 +1,6 @@ { "name": "ng2-ismi-query-app", - "version": "1.0.0", + "version": "1.1.0", "scripts": { "build": "tsc -p src/", "build:watch": "tsc -p src/ -w",
--- a/src/app/query-app.module.ts Thu Mar 23 11:04:48 2017 +0100 +++ b/src/app/query-app.module.ts Thu Mar 23 13:41:30 2017 +0100 @@ -4,7 +4,7 @@ import { HttpModule } from '@angular/http'; import { Ng2TableModule } from 'ng2-table/ng2-table'; -import { PaginationModule } from 'ng2-bootstrap/pagination'; +import { PaginationModule } from 'ng2-bootstrap'; import { QueryAppComponent } from './query-app.component'; import { QuerySelectComponent } from './query-select.component'; @@ -17,7 +17,7 @@ @NgModule({ imports: [ BrowserModule, FormsModule, HttpModule, - Ng2TableModule, PaginationModule ], + Ng2TableModule, PaginationModule.forRoot() ], declarations: [ QueryAppComponent, QuerySelectComponent, // QueryResultComponent, QueryResultRowComponent QueryResultTableComponent ],
--- a/src/app/query-result-table.component.ts Thu Mar 23 11:04:48 2017 +0100 +++ b/src/app/query-result-table.component.ts Thu Mar 23 13:41:30 2017 +0100 @@ -17,7 +17,7 @@ <div *ngIf="!showTable"><button (click)="showTable=true">show results</button></div> <div *ngIf="showTable"> <div>Show - <select (change)="onSelectNumItems($event)"> + <select name="numItems" (change)="onSelectNumItems($event)"> <option value="10">10</option> <option value="100">100</option> <option value="0">all</option> @@ -28,15 +28,14 @@ <form (ngSubmit)="onSelectCols($event)"> Columns: <span *ngFor=" let col of allColumns"> - <input type="checkbox" value="{{col.name}}" [(ngModel)]="col.show">{{col.name}} + <input type="checkbox" name="colName" value="{{col.name}}" [(ngModel)]="col.show">{{col.name}} </span> <button type="submit">change columns</button> </form> </div> - <div *ngIf="config.paging">Page {{page}} of {{numPages}}</div> - <pagination *ngIf="config.paging" - class="pagination-sm" - [(ngModel)]="page" + <!-- <div *ngIf="config.paging">Page {{currentPage}} of {{numPages}}</div> --> + <pagination *ngIf="config.paging" class="pagination-sm" + [(ngModel)]="currentPage" [totalItems]="length" [itemsPerPage]="itemsPerPage" [maxSize]="maxSize" @@ -69,7 +68,7 @@ public rows: Array<any>; - public page: number = 1; + public currentPage: number = 1; public itemsPerPage: number = 10; public maxSize: number = 5; public numPages: number = 1; @@ -87,7 +86,7 @@ this.allColumns = this.queryState.resultColumns; this.columns = this.allColumns.filter(c => c.show); this.config.sorting = this.columns; - this.config.paging = {'page': this.page, 'itemsPerPage': this.itemsPerPage}; + this.config.paging = {'page': this.currentPage, 'itemsPerPage': this.itemsPerPage}; this.showTable = (this.data.length < 1000); this.onChangeTable(this.config); } @@ -106,7 +105,7 @@ this.itemsPerPage = num; } // update something - this.config.paging = {'page': this.page, 'itemsPerPage': this.itemsPerPage}; + this.config.paging = {'page': this.currentPage, 'itemsPerPage': this.itemsPerPage}; this.onChangeTable(this.config); } @@ -163,8 +162,8 @@ Object.assign(this.config.sorting, config.sorting); // changing sorting resets page if (page == null) { - this.page = 1; - page = {'page': this.page, 'itemsPerPage': this.itemsPerPage}; + this.currentPage = 1; + page = {'page': this.currentPage, 'itemsPerPage': this.itemsPerPage}; } }
--- a/src/systemjs.config.js Thu Mar 23 11:04:48 2017 +0100 +++ b/src/systemjs.config.js Thu Mar 23 13:41:30 2017 +0100 @@ -37,6 +37,14 @@ }, rxjs: { defaultExtension: 'js' + }, + 'ng2-bootstrap': { + format: 'cjs', + main: 'bundles/ng2-bootstrap.umd.js', + defaultExtension: 'js' + }, + 'ng2-table': { + defaultExtension: 'js' } } });