-
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 hier-grid esf LOD sample
- Loading branch information
1 parent
9ba15c7
commit 5dac9ed
Showing
8 changed files
with
139 additions
and
1 deletion.
There are no files selected for viewing
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
31 changes: 31 additions & 0 deletions
31
...ring-load-on-demand/hierarchical-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,31 @@ | ||
<div class="wrapper"> | ||
<igx-hierarchical-grid #hierarchicalGrid [primaryKey]="'Artist'" [data]="localdata" height="750px" [displayDensity]="'cosy'" | ||
[showToolbar]="true" [columnHiding]="true" [columnPinning]="true" [autoGenerate]="false" | ||
[allowFiltering]="true" [filterMode]="'excelStyleFilter'" | ||
[uniqueColumnValuesStrategy]="singersColumnValuesStrategy"> | ||
<igx-column field="Photo" [filterable]="false"> | ||
<ng-template igxCell let-cell="cell"> | ||
<div class="cell__inner"> | ||
<img [src]="cell.value" class="photo" /> | ||
</div> | ||
</ng-template> | ||
</igx-column> | ||
<igx-column field="Artist" [sortable]="true" [movable]="true"></igx-column> | ||
<igx-column field="Debut" [sortable]="true" [movable]="true" [dataType]="'number'"></igx-column> | ||
<igx-column field="GrammyNominations" header="Grammy Nominations" [dataType]="'number'" [sortable]="true" [movable]="true"></igx-column> | ||
<igx-column field="GrammyAwards" header="Grammy Awards" [dataType]="'number'" [sortable]="true" [movable]="true"></igx-column> | ||
<igx-row-island [key]="'Albums'" [primaryKey]="'Album'" [autoGenerate]="false" [allowFiltering]="true" [filterMode]="'excelStyleFilter'" | ||
[uniqueColumnValuesStrategy]="albumsColumnValuesStrategy"> | ||
<igx-column field="Album" [sortable]="true" [movable]="true"></igx-column> | ||
<igx-column field="LaunchDate" header="Launch Date" [sortable]="true" [movable]="true" [dataType]="'date'"></igx-column> | ||
<igx-column field="BillboardReview" header="Billboard Review" [sortable]="true" [movable]="true" [dataType]="'number'"></igx-column> | ||
<igx-column field="USBillboard200" header="US Billboard 200" [sortable]="true" [movable]="true" [dataType]="'number'"></igx-column> | ||
<igx-row-island [key]="'Songs'" [primaryKey]="'Title'" [autoGenerate]="false" > | ||
<igx-column field="Number" header="No."></igx-column> | ||
<igx-column field="Title"></igx-column> | ||
<igx-column field="Released" dataType="date"></igx-column> | ||
<igx-column field="Genre"></igx-column> | ||
</igx-row-island> | ||
</igx-row-island> | ||
</igx-hierarchical-grid> | ||
</div> |
11 changes: 11 additions & 0 deletions
11
...ring-load-on-demand/hierarchical-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,11 @@ | ||
.wrapper { | ||
margin: 16px; | ||
} | ||
|
||
.photo { | ||
vertical-align: middle; | ||
max-height: 40px; | ||
} | ||
.cell__inner { | ||
margin: 1px auto 1px auto; | ||
} |
37 changes: 37 additions & 0 deletions
37
...tering-load-on-demand/hierarchical-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,37 @@ | ||
import { Component, OnInit } from "@angular/core"; | ||
import { IFilteringExpressionsTree, IgxColumnComponent } from "igniteui-angular"; | ||
import { RemoteValuesService } from "./remoteValues.service"; | ||
|
||
@Component({ | ||
selector: "app-hierarchical-grid-excel-style-filtering-load-on-demand", | ||
templateUrl: "./hierarchical-grid-excel-style-filtering-load-on-demand.component.html", | ||
styleUrls: ["./hierarchical-grid-excel-style-filtering-load-on-demand.component.scss"], | ||
providers: [RemoteValuesService] | ||
}) | ||
export class HierarchicalGridExcelStyleFilteringLoadOnDemandComponent implements OnInit { | ||
|
||
public localdata: any[]; | ||
|
||
constructor(private remoteValuesService: RemoteValuesService) { } | ||
|
||
public singersColumnValuesStrategy = (column: IgxColumnComponent, | ||
columnExprTree: IFilteringExpressionsTree, | ||
done: (uniqueValues: any[]) => void) => { | ||
// Get specific column data for the singers. | ||
this.remoteValuesService.getColumnData( | ||
null, "Singers", column, columnExprTree, uniqueValues => done(uniqueValues)); | ||
} | ||
|
||
public albumsColumnValuesStrategy = (column: IgxColumnComponent, | ||
columnExprTree: IFilteringExpressionsTree, | ||
done: (uniqueValues: any[]) => void) => { | ||
// Get specific column data for the albums of a specific singer. | ||
const parentRowId = (column.grid as any).foreignKey; | ||
this.remoteValuesService.getColumnData( | ||
parentRowId, "Albums", column, columnExprTree, uniqueValues => done(uniqueValues)); | ||
} | ||
|
||
public ngOnInit() { | ||
this.localdata = this.remoteValuesService.getSingersData(); | ||
} | ||
} |
34 changes: 34 additions & 0 deletions
34
...hical-grid/hierarchical-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,34 @@ | ||
import { Injectable } from "@angular/core"; | ||
import { FilteringStrategy, IFilteringExpressionsTree, IgxColumnComponent } from "igniteui-angular"; | ||
import { SINGERS } from "../data"; | ||
|
||
@Injectable() | ||
export class RemoteValuesService { | ||
private _filteringStrategy = new FilteringStrategy(); | ||
|
||
public getSingersData() { | ||
return SINGERS; | ||
} | ||
|
||
public getColumnData(parentId: any, key: string, | ||
column: IgxColumnComponent, | ||
columnExprTree: IFilteringExpressionsTree, | ||
done: (colVals: any[]) => void) { | ||
setTimeout(() => { | ||
let filteredData = []; | ||
|
||
if (!parentId) { | ||
// Generate unique column values for the singers. | ||
filteredData = this._filteringStrategy.filter(this.getSingersData(), columnExprTree); | ||
} else if (key === "Albums") { | ||
// Generate unique column values for the albums of a specific singer. | ||
const singer = this.getSingersData().find((rec) => rec.Artist === parentId); | ||
const albums = singer ? (singer.Albums ? singer.Albums : []) : []; | ||
filteredData = this._filteringStrategy.filter(albums, 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