Commit a04ea9538015087edde6d5c82e30639d69f679a8

Authored by Yarik
1 parent c29d372d

awe

src/models/statement.base.ts
... ... @@ -48,8 +48,10 @@ export abstract class StatementBase implements AfterViewInit, OnInit {
48 48 protected initGrid(): void {
49 49 this.gridOptions = <GridOptions>{};
50 50 this.gridOptions.enableSorting = true;
  51 + this.gridOptions.enableFilter = true;
51 52 this.gridOptions.suppressMultiSort = true;
52 53 this.gridOptions.enableServerSideSorting = true;
  54 + this.gridOptions.enableServerSideFilter = true;
53 55 this.showGrid = true;
54 56 this.gridOptions.rowModelType = 'virtual';
55 57 this.gridOptions.paginationPageSize = 25;
... ... @@ -64,6 +66,7 @@ export abstract class StatementBase implements AfterViewInit, OnInit {
64 66 let dataSource: {} = {
65 67 rowCount: null,
66 68 getRows: (params: IGetRowsParams) => {
  69 + console.log(params);
67 70 let sort: string = null;
68 71 if (params.sortModel.length) {
69 72 sort = this.parseSort(params.sortModel[0]);
... ... @@ -95,7 +98,7 @@ export abstract class StatementBase implements AfterViewInit, OnInit {
95 98 }
96 99  
97 100 protected getFirstRowID(): number {
98   - let model = this.gridOptions.api.getModel().getRow(0);
  101 + let model: RowNode = this.gridOptions.api.getModel().getRow(0);
99 102 let id: number = model.data.id;
100 103 if (id) {
101 104 return id;
... ...
src/services/statement.base.service.ts
1 1 import { Headers, Http, Response } from '@angular/http';
2 2  
  3 +import { Observable } from 'rxjs/Observable';
3 4 import 'rxjs/add/operator/toPromise';
  5 +import 'rxjs/add/operator/map';
4 6  
5 7 export abstract class StatementBaseService {
6 8 protected abstract url: string;
... ... @@ -20,6 +22,12 @@ export abstract class StatementBaseService {
20 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 31 update(id: number, data: string): Promise<any> {
24 32 return this.http.post(this.url + '/update?id=' + id, data, { headers: this.headers })
25 33 .toPromise()
... ...