Pivot Grid の状態保持
igxGridState ディレクティブによって開発者がグリッドの状態を簡単に保存および復元できます。IgxGridState
ディレクティブがグリッドに適用されると、getState
および setState
メソッドが公開され、開発者はこれを使用して、あらゆるシナリオで状態の永続化を実現できます。
サポートされている機能
IgxGridState
ディレクティブは、以下の機能の状態の保存および復元をサポートします。
ソート
フィルタリング
セルの選択
行の選択
列の選択
展開
ピボット構成
Row Selection
機能を使用するには、primaryKey
プロパティを設定して、正しく保存/復元する必要があります。
使用方法
getState
- このメソッドは、シリアル化された JSON 文字列でグリッド状態を返します。これは、開発者がそれを取得して任意のデータストレージ (データベース、クラウド、ブラウザーの localStorage など) に保存できます。このメソッドは最初のオプションのパラメーター serialize
を受け取り、getState
が IGridState
オブジェクトを返すか、シリアル化された JSON 文字列を返すかを決定します。
開発者は、機能名、または機能名を 2 番目の引数として持つ配列を渡すことにより、特定の機能の状態のみを取得することを選択できます。
const gridState = state.getState();
const gridState: IGridState = state.getState(false );
const sortingFilteringStates: IGridState = state.getState(false , ['sorting' , 'filtering' ]);
typescript
setState
- setState
メソッドは、シリアル化されたJSON文字列または IGridState
オブジェクトを引数として受け入れ、オブジェクト/JSON 文字列で見つかった各機能の状態を復元します。
state.setState(gridState);
state.setState(sortingFilteringStates)
typescript
options
- options
オブジェクトは、IGridStateOptions
インターフェースを実装します。特定の機能の名前であるキーには、この機能の状態を追跡するかどうかを示すブール値があります。getState
メソッドはこれらの機能の状態を戻り値に入れず、setState
メソッドはその状態を復元しません。
public options = { cellSelection : false ; sorting: false ; }
typescript
<igx-pivot-grid [igxGridState ]="options" > </igx-pivot-grid >
html
これらのシンプルなシングル ポイント API を使用すると、わずか数行のコードで完全な状態維持機能を実現できます。下からコードをコピーして貼り付けます - ユーザーが現在のページを離れるたびに、ブラウザーの sessionStorage
オブジェクトにグリッドの状態が保存されます。ユーザーがメイン ページに戻るときに、グリッドの状態が復元されます。必要なデータを取得するために、複雑で高度なフィルタリングやソートの式を毎回設定する必要はなくなりました。一度実行して、以下のコードでユーザーに代わって処理してください。
@ViewChild (IgxGridStateDirective, { static : true })
public state!: IgxGridStateDirective;
public ngOnInit ( ) {
this .router.events.pipe(take(1 )).subscribe((event: NavigationStart ) => {
this .saveGridState();
});
}
public ngAfterViewInit ( ) {
this .restoreGridState();
}
public saveGridState ( ) {
const state = this .state.getState() as string ;
window .sessionStorage.setItem('grid1-state' , state);
}
public restoreGridState ( ) {
const state = window .sessionStorage.getItem('grid1-state' );
this .state.setState(state);
}
typescript
ピボット構成の復元
IgxGridState
は、デフォルトではピボット ディメンション関数、値フォーマッターなどを保持しません (制限
を参照)。IgxPivotGrid
は、構成に含まれるカスタム関数を戻すために使用できる 2 つのイベント (dimensionInit
と valueInit
) を公開します。以下はその方法です。
dimensionInit
および valueInit
イベントのイベント ハンドラーを割り当てます。
<igx-pivot-grid #grid1 [data ]="data" [pivotConfiguration ]="pivotConfig" [igxGridState ]="options"
(valueInit )='onValueInit($event)' (dimensionInit )='onDimensionInit($event)' >
</igx-pivot-grid >
html
dimensionInit
および valueInit
イベントは、pivotConfiguration
プロパティで定義された値とディメンションごとに発行されます。
valueInit
イベント ハンドラーで、すべてのカスタム集計、フォーマッター、およびスタイルを設定します。
public onValueInit (value: IPivotValue ) {
if (value.member === 'AmountofSale' ) {
value.aggregate.aggregator = IgxTotalSaleAggregate.totalSale;
value.aggregateList?.forEach((aggr: IPivotAggregator ) => {
switch (aggr.key) {
case 'SUM' :
aggr.aggregator = IgxTotalSaleAggregate.totalSale;
break ;
case 'MIN' :
aggr.aggregator = IgxTotalSaleAggregate.totalMin;
break ;
case 'MAX' :
aggr.aggregator = IgxTotalSaleAggregate.totalMax;
break ;
}
});
} else if (value.member === 'Value' ) {
value.formatter = (value ) => value ? '$' + parseFloat (value).toFixed(3 ) : undefined ;
value.styles.upFontValue = (rowData: any , columnKey : any ): boolean => parseFloat (rowData.aggregationValues.get(columnKey.field)) > 150
value.styles.downFontValue = (rowData: any , columnKey : any ): boolean => parseFloat (rowData.aggregationValues.get(columnKey.field)) <= 150 ;
}
}
typescript
dimensionInit
イベント ハンドラーで、すべてのカスタム memberFunction
実装を設定します。
public onDimensionInit (dim: IPivotDimension ) {
switch (dim.memberName) {
case 'AllProducts' :
dim.memberFunction = () => 'All Products' ;
break ;
case 'ProductCategory' :
dim.memberFunction = (data ) => data.Product.Name;
break ;
case 'City' :
dim.memberFunction = (data ) => data.Seller.City;
break ;
case 'SellerName' :
dim.memberFunction = (data ) => data.Seller.Name;
break ;
}
}
typescript
import { NgModule } from "@angular/core" ;
import { FormsModule } from "@angular/forms" ;
import { BrowserModule } from "@angular/platform-browser" ;
import { BrowserAnimationsModule } from "@angular/platform-browser/animations" ;
import { AppComponent } from "./app.component" ;
import {
IgxPivotGridModule,
IgxTooltipModule,
IgxToastModule,
IgxSwitchModule
} from "igniteui-angular" ;
import { PivotGridStatePersistenceSampleComponent } from "./pivot-grid/pivot-state-persistence/pivot-grid-state-persistence-sample.component" ;
import { PivotGridAboutComponent } from "./pivot-grid/pivot-state-persistence/about.component" ;
import { IgxPreventDocumentScrollModule } from "./directives/prevent-scroll.directive" ;
import {
Router,
RouterModule
} from "@angular/router" ;
@NgModule ({
bootstrap : [AppComponent],
declarations : [
AppComponent,
PivotGridStatePersistenceSampleComponent
],
imports : [
BrowserModule,
BrowserAnimationsModule,
FormsModule,
IgxPreventDocumentScrollModule,
IgxPivotGridModule,
IgxTooltipModule,
PivotGridAboutComponent,
RouterModule.forRoot([{component : PivotGridAboutComponent, path : 'pivot-grid-about' },{component : PivotGridStatePersistenceSampleComponent, path : 'pivot-grid-state-persistance' },{ path : '' , redirectTo : '/pivot-grid-state-persistance' , pathMatch : 'full' }]),
IgxToastModule,
IgxSwitchModule
],
providers : [],
entryComponents : [],
schemas : []
})
export class AppModule {}
ts コピー import { AfterViewInit, Component, OnInit, QueryList, ViewChild, ViewChildren } from "@angular/core" ;
import { NavigationStart, Router } from "@angular/router" ;
import {
IPivotConfiguration, PivotAggregation, IgxPivotNumericAggregate,
IgxPivotDateDimension, IgxGridStateDirective, IgxPivotGridComponent, IgxCheckboxComponent, GridFeatures, IGridStateOptions, IGridState, IPivotValue, IPivotDimension, IPivotAggregator, GridColumnDataType
} from "igniteui-angular"
import { take } from "rxjs/operators" ;
import { SALES_DATA } from "../../data/dataToAnalyze" ;
export class IgxTotalSaleAggregate {
public static totalSale: PivotAggregation = (members, data: any ) =>
data.reduce((accumulator, value ) => accumulator + value.Product.UnitPrice * value.NumberOfUnits, 0 );
public static totalMin: PivotAggregation = (members, data: any ) => {
let min = 0 ;
if (data.length === 1 ) {
min = data[0 ].Product.UnitPrice * data[0 ].NumberOfUnits;
} else if (data.length > 1 ) {
const mappedData = data.map(x => x.Product.UnitPrice * x.NumberOfUnits);
min = mappedData.reduce((a, b ) => Math .min(a, b));
}
return min;
};
public static totalMax: PivotAggregation = (members, data: any ) => {
let max = 0 ;
if (data.length === 1 ) {
max = data[0 ].Product.UnitPrice * data[0 ].NumberOfUnits;
} else if (data.length > 1 ) {
const mappedData = data.map(x => x.Product.UnitPrice * x.NumberOfUnits);
max = mappedData.reduce((a, b ) => Math .max(a, b));
}
return max;
};
}
@Component ({
selector : 'app-pivot-grid-state-persistence-sample' ,
styleUrls : ['./pivot-grid-state-persistence-sample.component.scss' ],
templateUrl : './pivot-grid-state-persistence-sample.component.html'
})
export class PivotGridStatePersistenceSampleComponent implements OnInit , AfterViewInit {
@ViewChild (IgxGridStateDirective, { static : true }) public state: IgxGridStateDirective;
@ViewChild (IgxPivotGridComponent, { static : true }) public grid: IgxPivotGridComponent;
@ViewChildren (IgxCheckboxComponent) public checkboxes: QueryList<IgxCheckboxComponent>;
public data = SALES_DATA;
public serialize = true ;
public stateKey = 'grid-state' ;
public features: { key : GridFeatures; shortName: string }[] = [
{ key : 'cellSelection' , shortName : 'Cell Sel' },
{ key : 'columnSelection' , shortName : 'Cols Sel' },
{ key : 'expansion' , shortName : 'Expansion' },
{ key : 'filtering' , shortName : 'Filt' },
{ key : 'sorting' , shortName : 'Sorting' },
{ key : 'pivotConfiguration' , shortName : 'Pivot Configuration' }
];
public options: IGridStateOptions = {
cellSelection : true ,
filtering : true ,
sorting : true ,
expansion : true ,
columnSelection : true ,
pivotConfiguration : true
};
public pivotConfig: IPivotConfiguration = {
columns : [
new IgxPivotDateDimension(
{
memberName : 'Date' ,
enabled : true
},
{
months : false ,
quarters : true ,
fullDate : false
}
)
],
rows : [
{
memberFunction : () => 'All Products' ,
memberName : 'AllProducts' ,
enabled : true ,
width : "150px" ,
childLevel : {
memberFunction : (data ) => data.Product.Name,
memberName : 'ProductCategory' ,
enabled : true
}
},
{
memberName : 'City' ,
width : "150px" ,
memberFunction : (data ) => data.Seller.City,
enabled : true
}
],
values : [
{
member : 'Value' ,
aggregate : {
key : 'SUM' ,
aggregator : IgxPivotNumericAggregate.sum,
label : 'Sum'
},
aggregateList : [{
key : 'SUM' ,
aggregator : IgxPivotNumericAggregate.sum,
label : 'Sum'
}],
enabled : true ,
dataType : GridColumnDataType.Number,
styles : {
downFontValue : (rowData: any , columnKey : any ): boolean => parseFloat (rowData.aggregationValues.get(columnKey.field)) <= 150 ,
upFontValue : (rowData: any , columnKey : any ): boolean => parseFloat (rowData.aggregationValues.get(columnKey.field)) > 150
},
formatter : (value ) => value ? '$' + parseFloat (value).toFixed(3 ) : undefined
},
{
member : 'AmountofSale' ,
displayName : 'Amount of Sale' ,
aggregate : {
key : 'SUM' ,
aggregator : IgxTotalSaleAggregate.totalSale,
label : 'Sum of Sale'
},
aggregateList : [{
key : 'SUM' ,
aggregator : IgxTotalSaleAggregate.totalSale,
label : 'Sum of Sale'
}, {
key : 'MIN' ,
aggregator : IgxTotalSaleAggregate.totalMin,
label : 'Minimum of Sale'
}, {
key : 'MAX' ,
aggregator : IgxTotalSaleAggregate.totalMax,
label : 'Maximum of Sale'
}],
enabled : true ,
dataType : GridColumnDataType.Currency
}
],
filters : [
{
memberName : 'SellerName' ,
memberFunction : (data ) => data.Seller.Name,
enabled : true
}
]
};
constructor (private router: Router ) { }
public ngOnInit(): void {
this .router.events.pipe(take(1 )).subscribe((event: NavigationStart ) => {
this .saveGridState();
});
}
public ngAfterViewInit(): void {
this .restoreGridState();
}
public saveGridState ( ) {
const state = this .state.getState(this .serialize);
if (typeof state === 'string' ) {
window .sessionStorage.setItem(this .stateKey, state);
} else {
window .sessionStorage.setItem(this .stateKey, JSON .stringify(state));
}
}
public restoreGridState ( ) {
const state = window .sessionStorage.getItem(this .stateKey);
if (state) {
this .state.setState(state);
}
}
public restoreFeature (stateDirective: IgxGridStateDirective, feature: string ) {
const state = this .getFeatureState(this .stateKey, feature);
if (state) {
const featureState = {} as IGridState;
featureState[feature] = state;
stateDirective.setState(featureState);
}
}
public getFeatureState (stateKey: string , feature: string ) {
let state = window .sessionStorage.getItem(stateKey);
state = state ? JSON .parse(state)[feature] : null ;
return state;
}
public onChange (event: any , action: string ) {
if (action === 'toggleAll' ) {
this .checkboxes.forEach(cb => {
cb.checked = event.checked;
});
for (const key of Object .keys(this .options)) {
this .state.options[key] = event.checked;
}
return ;
}
this .state.options[action] = event.checked;
}
public clearStorage ( ) {
window .sessionStorage.removeItem(this .stateKey);
}
public reloadPage ( ) {
window .location.reload();
}
public onValueInit (value: IPivotValue ) {
if (value.member === 'AmountofSale' ) {
value.aggregate.aggregator = IgxTotalSaleAggregate.totalSale;
value.aggregateList?.forEach((aggr: IPivotAggregator ) => {
switch (aggr.key) {
case 'SUM' :
aggr.aggregator = IgxTotalSaleAggregate.totalSale;
break ;
case 'MIN' :
aggr.aggregator = IgxTotalSaleAggregate.totalMin;
break ;
case 'MAX' :
aggr.aggregator = IgxTotalSaleAggregate.totalMax;
break ;
}
});
} else if (value.member === 'Value' ) {
value.formatter = (value ) => value ? '$' + parseFloat (value).toFixed(3 ) : undefined ;
value.styles.upFontValue = (rowData: any , columnKey : any ): boolean => parseFloat (rowData.aggregationValues.get(columnKey.field)) > 150
value.styles.downFontValue = (rowData: any , columnKey : any ): boolean => parseFloat (rowData.aggregationValues.get(columnKey.field)) <= 150 ;
}
}
public onDimensionInit (dim: IPivotDimension ) {
switch (dim.memberName) {
case 'AllProducts' :
dim.memberFunction = () => 'All Products' ;
break ;
case 'ProductCategory' :
dim.memberFunction = (data ) => data.Product.Name;
break ;
case 'City' :
dim.memberFunction = (data ) => data.Seller.City;
break ;
case 'SellerName' :
dim.memberFunction = (data ) => data.Seller.Name;
break ;
}
}
}
ts コピー <div class ="controls-holder" >
<div class ="switches" >
<button igxButton ="raised" (click )="restoreGridState()" >
<igx-icon class ="btn-icon" > restore</igx-icon >
<span > Restore</span >
</button >
<button igxButton ="raised" (click )="saveGridState()" >
<igx-icon class ="btn-icon" > save</igx-icon >
<span > Save</span >
</button >
<button igxButton ="raised" [routerLink ]="['../pivot-state-about']" >
<igx-icon class ="btn-icon" > forward</igx-icon >
<span > Leave</span >
</button >
<button igxButton ="raised" (click )="clearStorage()" >
<igx-icon class ="btn-icon" > delete</igx-icon >
<span > Clear</span >
</button >
<button igxButton ="raised" (click )="reloadPage()" >
<igx-icon class ="btn-icon" > refresh</igx-icon >
<span > Reload</span >
</button >
</div >
<div class ="switches" >
<ul >
<li > Clicking the SAVE button or leaving the page <a
[routerLink ]="['../pivot-state-about']" > <strong > here</strong > </a > will save grid state to
localStorage.</li >
<li > Use the control buttons to SAVE / RESTORE / DELETE / grid state or LEAVE the page.</li >
<li > Select/Deselect checkboxes to control saving / restoring feature state.</li >
</ul >
</div >
<div class ="switches" >
<div class ="control-item" >
<igx-checkbox [checked ]="true" (change )="onChange($event, 'toggleAll')" > All</igx-checkbox >
</div >
<div class ="control-item" *ngFor ="let f of features" >
<igx-checkbox (change )="onChange($event, f.key)" [checked ]="options[f.key]" >
{{ f.shortName }}
</igx-checkbox >
</div >
</div >
</div >
<igx-pivot-grid #grid1 [data ]="data" [pivotConfiguration ]="pivotConfig" [rowSelection ]="'single'" [height ]="'600px'"
[superCompactMode ]="true" [defaultExpandState ]='true' [columnSelection ]="'single'" [igxGridState ]="options"
(valueInit )='onValueInit($event)' (dimensionInit )='onDimensionInit($event)' >
</igx-pivot-grid >
html コピー :host {
padding : 8px ;
display : flex;
flex-direction : column;
::ng-deep {
.upFontValue {
color: hsla(var(--ig-success-500 ));
}
.downFontValue {
color : hsla(var(--ig-error-500 ));
}
}
}
igx-pivot-grid {
flex : 1 ;
}
.pivot-container {
display : flex;
align-items : flex-start;
flex : 1 1 auto;
order : 0 ;
}
.controls-holder {
display : flex;
justify-content : space-between;
align-items : center;
flex-wrap : wrap;
width : 100% ;
}
.switches {
display : flex;
justify-content : flex-start;
align-items : center;
flex : 1 0 0% ;
min-width : 100% ;
padding-right : 20px ;
font-size : 0.9rem ;
margin-top : 0 ;
>button {
margin-right : 10px ;
}
}
.control-item {
display : block;
padding : 8px 0 ;
>span {
cursor : pointer;
}
margin-right : 10px ;
}
scss コピー
このサンプルが気に入りましたか? 完全な Ignite UI for Angularツールキットにアクセスして、すばやく独自のアプリの作成を開始します。無料でダウンロードできます。
ピボット ストラテジの復元
IgxGridState
は、デフォルトで は (制限
を参照) リモート ピボット操作もカスタム ディメンション ストラテジも保持しません (詳細については、Pivot Grid リモート操作 のサンプルを参照してください)。これらの復元は、アプリケーション レベルのコードで実現できます。IgxGridState
は、stateParsed
と呼ばれるイベントを公開します。このイベントはグリッド状態が適用される前に追加で変更するために使用できます。以下はその方法です。
stateParsed
は、文字列引数で setState
を使用している場合にのみ発行します。
カスタム ソート方法およびカスタム ピボット列/行ディメンション ストラテジを設定します。
<igx-pivot-grid #grid [data ]="data" [pivotConfiguration ]="pivotConfigHierarchy" [defaultExpandState ]='true'
[igxGridState ]="options" [sortStrategy ]="customStrategy" [pivotUI ]='{ showConfiguration: false }' [superCompactMode ]="true" [height ]="'500px'" >
</igx-pivot-grid >
html
@ViewChild (IgxGridStateDirective, { static : true })
public state!: IgxGridStateDirective;
public customStrategy = NoopSortingStrategy.instance();
public options: IGridStateOptions = {...};
public pivotConfigHierarchy: IPivotConfiguration = {
columnStrategy : NoopPivotDimensionsStrategy.instance(),
rowStrategy : NoopPivotDimensionsStrategy.instance(),
columns : [...],
rows : [...],
values : [...],
filters : [...]
};
typescript
sessionStorage
から状態を復元し、カスタム ストラテジを適用します。
public restoreState ( ) {
const state = window .sessionStorage.getItem('grid-state' );
this .state.stateParsed.pipe(take(1 )).subscribe(parsedState => {
parsedState.sorting.forEach(x => x.strategy = NoopSortingStrategy.instance());
parsedState.pivotConfiguration.rowStrategy = NoopPivotDimensionsStrategy.instance();
parsedState.pivotConfiguration.columnStrategy = NoopPivotDimensionsStrategy.instance();
});
this .state.setState(state as string );
}
typescript
import { NgModule } from "@angular/core" ;
import { FormsModule } from "@angular/forms" ;
import { BrowserModule } from "@angular/platform-browser" ;
import { BrowserAnimationsModule } from "@angular/platform-browser/animations" ;
import { AppComponent } from "./app.component" ;
import { IgxPivotGridModule } from "igniteui-angular" ;
import { PivotGridNoopPersistenceSampleComponent } from "./pivot-grid/pivot-grid-noop-persistence/pivot-grid-noop-persistence-sample.component" ;
import { IgxPreventDocumentScrollModule } from "./directives/prevent-scroll.directive" ;
import { PivotDataService } from "./services/pivotRemoteData.service" ;
@NgModule ({
bootstrap : [AppComponent],
declarations : [
AppComponent,
PivotGridNoopPersistenceSampleComponent
],
imports : [
BrowserModule,
BrowserAnimationsModule,
FormsModule,
IgxPreventDocumentScrollModule,
IgxPivotGridModule
],
providers : [PivotDataService],
entryComponents : [],
schemas : []
})
export class AppModule {}
ts コピー import { AfterViewInit, Component, ViewChild } from "@angular/core" ;
import { IPivotConfiguration, IgxPivotNumericAggregate, NoopPivotDimensionsStrategy, IgxPivotGridComponent, NoopSortingStrategy, IGridState, IGridStateOptions, IgxGridStateDirective } from "igniteui-angular"
import { PivotDataService } from "../../services/pivotRemoteData.service" ;
import { take } from 'rxjs/operators' ;
@Component ({
selector : 'app-pivot-grid-noop-persistence-sample' ,
styleUrls : ['./pivot-grid-noop-persistence-sample.component.scss' ],
templateUrl : './pivot-grid-noop-persistence-sample.component.html' ,
providers : [PivotDataService]
})
export class PivotGridNoopPersistenceSampleComponent implements AfterViewInit {
@ViewChild ('grid' , { static : true })
public grid: IgxPivotGridComponent;
@ViewChild (IgxGridStateDirective, { static : true })
public state!: IgxGridStateDirective;
public customStrategy = NoopSortingStrategy.instance();
public data: any [];
public options: IGridStateOptions = {
cellSelection : true ,
rowSelection : true ,
filtering : true ,
sorting : true ,
expansion : true ,
columnSelection : true ,
pivotConfiguration : true
};
public pivotConfigHierarchy: IPivotConfiguration = {
columnStrategy : NoopPivotDimensionsStrategy.instance(),
rowStrategy : NoopPivotDimensionsStrategy.instance(),
columns : [
{
memberName : 'Country' ,
enabled : true
}
],
rows : [
{
memberFunction : () => 'All' ,
memberName : 'AllProducts' ,
enabled : true ,
childLevel : {
memberFunction : (data ) => data.ProductCategory,
memberName : 'ProductCategory' ,
enabled : true
}
},
{
memberName : 'AllSeller' ,
memberFunction : () => 'All Sellers' ,
enabled : true ,
childLevel : {
enabled : true ,
memberName : 'SellerName'
}
}
],
values : [
{
member : 'UnitsSold' ,
aggregate : {
aggregator : IgxPivotNumericAggregate.sum,
key : 'sum' ,
label : 'Sum'
},
enabled : true ,
formatter : (value ) => value ? value : 0
}
],
filters : null
};
constructor (private _remoteService: PivotDataService ) {
}
ngAfterViewInit(): void {
this .grid.isLoading = true ;
this ._remoteService.getData().subscribe((data: any ) => {
this .grid.isLoading = false ;
this .data = data;
});
}
public saveState ( ) {
const state = this .state.getState() as string ;
window .sessionStorage.setItem('grid-state' , state);
}
public restoreState ( ) {
const state = window .sessionStorage.getItem('grid-state' );
this .state.stateParsed.pipe(take(1 )).subscribe(parsedState => {
parsedState.sorting.forEach(expression => expression.strategy = NoopSortingStrategy.instance());
parsedState.pivotConfiguration.rowStrategy = NoopPivotDimensionsStrategy.instance();
parsedState.pivotConfiguration.columnStrategy = NoopPivotDimensionsStrategy.instance();
});
this .state.setState(state as string );
}
public clearStorage ( ) {
window .sessionStorage.removeItem('grid-state' );
}
}
ts コピー <div class ="switches" >
<button igxButton ="raised" (click )="restoreState()" >
<igx-icon class ="btn-icon" > restore</igx-icon >
<span > Restore</span >
</button >
<button igxButton ="raised" (click )="saveState()" >
<igx-icon class ="btn-icon" > save</igx-icon >
<span > Save</span >
</button >
<button igxButton ="raised" (click )="clearStorage()" >
<igx-icon class ="btn-icon" > delete</igx-icon >
<span > Clear</span >
</button >
</div >
<igx-pivot-grid #grid [data ]="data" [pivotConfiguration ]="pivotConfigHierarchy" [defaultExpandState ]='true'
[igxGridState ]="options" [sortStrategy ]="customStrategy" [showPivotConfigurationUI ]='false' [superCompactMode ]="true" [height ]="'500px'" >
</igx-pivot-grid >
html コピー :host {
display : block;
padding : 8px ;
}
.switches {
display : flex;
justify-content : flex-start;
align-items : center;
flex : 1 0 0% ;
min-width : 100% ;
padding-right : 20px ;
font-size : 0.9rem ;
margin-top : 0 ;
margin-bottom : 10px ;
>button {
margin-right : 10px ;
}
}
scss コピー
制限
API リファレンス
その他のリソース