-
Notifications
You must be signed in to change notification settings - Fork 25
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
sample(esf): add grid esf LOD sample
1 parent
c0a036c
commit bf8dec2
Showing
8 changed files
with
515 additions
and
2 deletions.
There are no files selected for viewing
434 changes: 434 additions & 0 deletions
434
src/app/grid/grid-excel-style-filtering-load-on-demand/employees.ts
Large diffs are not rendered by default.
Oops, something went wrong.
16 changes: 16 additions & 0 deletions
16
...l-style-filtering-load-on-demand/grid-excel-style-filtering-load-on-demand.component.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
<div class="grid__wrapper"> | ||
<igx-grid #grid1 [data]="data" [height]="'750px'" [showToolbar]="true" [displayDensity]="'cosy'" | ||
[columnHiding]="true" [columnPinning]="true" [allowFiltering]="true" [filterMode]="'excelStyleFilter'" | ||
[uniqueColumnValuesStrategy]="columnValuesStrategy"> | ||
|
||
<igx-column [field]="'ID'" [filterable]="true" [sortable]="true" [movable]="true" [dataType]="'string'"></igx-column> | ||
<igx-column [field]="'CompanyName'" [filterable]="true" [sortable]="true" [movable]="true" [dataType]="'string'"></igx-column> | ||
<igx-column [field]="'Employees'" [filterable]="true" [sortable]="true" [movable]="true" [dataType]="'number'"></igx-column> | ||
<igx-column [field]="'Contract'" [filterable]="true" [sortable]="true" [movable]="true" [dataType]="'boolean'"></igx-column> | ||
<igx-column [field]="'DateCreated'" [filterable]="true" [sortable]="true" [movable]="true" [dataType]="'date'"></igx-column> | ||
|
||
<!-- <ng-template igxExcelStyleLoading> | ||
Loading ... | ||
</ng-template> --> | ||
</igx-grid> | ||
</div> |
3 changes: 3 additions & 0 deletions
3
...l-style-filtering-load-on-demand/grid-excel-style-filtering-load-on-demand.component.scss
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
.grid__wrapper { | ||
margin: 15px; | ||
} |
28 changes: 28 additions & 0 deletions
28
...cel-style-filtering-load-on-demand/grid-excel-style-filtering-load-on-demand.component.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import { Component, OnInit } from "@angular/core"; | ||
import { IFilteringExpressionsTree, IgxColumnComponent } from "igniteui-angular"; | ||
import { RemoteValuesService } from "./remoteValues.service"; | ||
|
||
@Component({ | ||
selector: "app-grid-excel-style-filtering-load-on-demand", | ||
styleUrls: ["./grid-excel-style-filtering-load-on-demand.component.scss"], | ||
templateUrl: "./grid-excel-style-filtering-load-on-demand.component.html", | ||
providers: [RemoteValuesService] | ||
}) | ||
export class GridExcelStyleFilteringLoadOnDemandComponent implements OnInit { | ||
|
||
public data: any[]; | ||
|
||
constructor(private remoteValuesService: RemoteValuesService) { } | ||
|
||
public columnValuesStrategy = (column: IgxColumnComponent, | ||
columnExprTree: IFilteringExpressionsTree, | ||
done: (uniqueValues: any[]) => void) => { | ||
// Get specific column data. | ||
this.remoteValuesService.getColumnData(column, columnExprTree, uniqueValues => done(uniqueValues)); | ||
} | ||
|
||
public ngOnInit() { | ||
// Get full data. | ||
this.data = this.remoteValuesService.getRecordsData(); | ||
} | ||
} |
22 changes: 22 additions & 0 deletions
22
src/app/grid/grid-excel-style-filtering-load-on-demand/remoteValues.service.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import { Injectable } from "@angular/core"; | ||
import { FilteringStrategy, IFilteringExpressionsTree, IgxColumnComponent } from "igniteui-angular"; | ||
import { SAMPLE_DATA } from "./employees"; | ||
|
||
@Injectable() | ||
export class RemoteValuesService { | ||
private _filteringStrategy = new FilteringStrategy(); | ||
|
||
public getRecordsData() { | ||
return SAMPLE_DATA; | ||
} | ||
|
||
public getColumnData(column: IgxColumnComponent, | ||
columnExprTree: IFilteringExpressionsTree, | ||
done: (colVals: any[]) => void) { | ||
setTimeout(() => { | ||
const filteredData = this._filteringStrategy.filter(this.getRecordsData(), columnExprTree); | ||
const columnValues = filteredData.map(record => record[column.field]); | ||
done(columnValues); | ||
}, 1000); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters