Commit a04ea9538015087edde6d5c82e30639d69f679a8
1 parent
c29d372d
awe
Showing
2 changed files
with
12 additions
and
1 deletions
Show diff stats
src/models/statement.base.ts
@@ -48,8 +48,10 @@ export abstract class StatementBase implements AfterViewInit, OnInit { | @@ -48,8 +48,10 @@ export abstract class StatementBase implements AfterViewInit, OnInit { | ||
48 | protected initGrid(): void { | 48 | protected initGrid(): void { |
49 | this.gridOptions = <GridOptions>{}; | 49 | this.gridOptions = <GridOptions>{}; |
50 | this.gridOptions.enableSorting = true; | 50 | this.gridOptions.enableSorting = true; |
51 | + this.gridOptions.enableFilter = true; | ||
51 | this.gridOptions.suppressMultiSort = true; | 52 | this.gridOptions.suppressMultiSort = true; |
52 | this.gridOptions.enableServerSideSorting = true; | 53 | this.gridOptions.enableServerSideSorting = true; |
54 | + this.gridOptions.enableServerSideFilter = true; | ||
53 | this.showGrid = true; | 55 | this.showGrid = true; |
54 | this.gridOptions.rowModelType = 'virtual'; | 56 | this.gridOptions.rowModelType = 'virtual'; |
55 | this.gridOptions.paginationPageSize = 25; | 57 | this.gridOptions.paginationPageSize = 25; |
@@ -64,6 +66,7 @@ export abstract class StatementBase implements AfterViewInit, OnInit { | @@ -64,6 +66,7 @@ export abstract class StatementBase implements AfterViewInit, OnInit { | ||
64 | let dataSource: {} = { | 66 | let dataSource: {} = { |
65 | rowCount: null, | 67 | rowCount: null, |
66 | getRows: (params: IGetRowsParams) => { | 68 | getRows: (params: IGetRowsParams) => { |
69 | + console.log(params); | ||
67 | let sort: string = null; | 70 | let sort: string = null; |
68 | if (params.sortModel.length) { | 71 | if (params.sortModel.length) { |
69 | sort = this.parseSort(params.sortModel[0]); | 72 | sort = this.parseSort(params.sortModel[0]); |
@@ -95,7 +98,7 @@ export abstract class StatementBase implements AfterViewInit, OnInit { | @@ -95,7 +98,7 @@ export abstract class StatementBase implements AfterViewInit, OnInit { | ||
95 | } | 98 | } |
96 | 99 | ||
97 | protected getFirstRowID(): number { | 100 | protected getFirstRowID(): number { |
98 | - let model = this.gridOptions.api.getModel().getRow(0); | 101 | + let model: RowNode = this.gridOptions.api.getModel().getRow(0); |
99 | let id: number = model.data.id; | 102 | let id: number = model.data.id; |
100 | if (id) { | 103 | if (id) { |
101 | return id; | 104 | return id; |
src/services/statement.base.service.ts
1 | import { Headers, Http, Response } from '@angular/http'; | 1 | import { Headers, Http, Response } from '@angular/http'; |
2 | 2 | ||
3 | +import { Observable } from 'rxjs/Observable'; | ||
3 | import 'rxjs/add/operator/toPromise'; | 4 | import 'rxjs/add/operator/toPromise'; |
5 | +import 'rxjs/add/operator/map'; | ||
4 | 6 | ||
5 | export abstract class StatementBaseService { | 7 | export abstract class StatementBaseService { |
6 | protected abstract url: string; | 8 | protected abstract url: string; |
@@ -20,6 +22,12 @@ export abstract class StatementBaseService { | @@ -20,6 +22,12 @@ export abstract class StatementBaseService { | ||
20 | .catch(this.handleError); | 22 | .catch(this.handleError); |
21 | } | 23 | } |
22 | 24 | ||
25 | + // search(term: string): Observable<any[]> { | ||
26 | + // return this.http | ||
27 | + // .get(`app/heroes/?name=${term}`) | ||
28 | + // .map(response => response.json().data as any[]); | ||
29 | + // } | ||
30 | + | ||
23 | update(id: number, data: string): Promise<any> { | 31 | update(id: number, data: string): Promise<any> { |
24 | return this.http.post(this.url + '/update?id=' + id, data, { headers: this.headers }) | 32 | return this.http.post(this.url + '/update?id=' + id, data, { headers: this.headers }) |
25 | .toPromise() | 33 | .toPromise() |