@@ -12,6 +12,7 @@ import { GridSelectionRange } from './selection/selection.service';
1212import { IGroupByExpandState } from '../data-operations/groupby-expand-state.interface' ;
1313import { IGroupingState } from '../data-operations/groupby-state.interface' ;
1414import { IgxGridComponent } from './grid/grid.component' ;
15+ import { IPinningConfig } from './common/grid.interface' ;
1516
1617export interface IGridState {
1718 columns ?: IColumnState [ ] ;
@@ -24,6 +25,7 @@ export interface IGridState {
2425 rowSelection ?: any [ ] ;
2526 columnSelection ?: string [ ] ;
2627 rowPinning ?: any [ ] ;
28+ pinningConfig ?: IPinningConfig ;
2729}
2830
2931export interface IGridStateOptions {
@@ -37,6 +39,7 @@ export interface IGridStateOptions {
3739 rowSelection ?: boolean ;
3840 columnSelection ?: boolean ;
3941 rowPinning ?: boolean ;
42+ pinningConfig ?: boolean ;
4043}
4144
4245export interface IColumnState {
@@ -69,6 +72,7 @@ const GROUPBY = 'groupBy';
6972const PAGING = 'paging' ;
7073const ROW_SELECTION = 'rowSelection' ;
7174const ROW_PINNING = 'rowPinning' ;
75+ const PINNING_CONFIG = 'pinningConfig' ;
7276const CELL_SELECTION = 'cellSelection' ;
7377const COLUMN_SELECTION = 'columnSelection' ;
7478
@@ -224,6 +228,10 @@ export class IgxGridStateDirective {
224228 this . restoreRowPinning ( state as any [ ] ) ;
225229 break ;
226230 }
231+ case PINNING_CONFIG : {
232+ this . restorePinningConfig ( state as IPinningConfig ) ;
233+ break ;
234+ }
227235 case CELL_SELECTION : {
228236 this . restoreCellSelection ( state as GridSelectionRange [ ] ) ;
229237 break ;
@@ -291,6 +299,10 @@ export class IgxGridStateDirective {
291299 Object . assign ( state , this . getRowPinning ( ) ) ;
292300 break ;
293301 }
302+ case PINNING_CONFIG : {
303+ Object . assign ( state , this . getPinningConfig ( ) ) ;
304+ break ;
305+ }
294306 case CELL_SELECTION : {
295307 Object . assign ( state , this . getCellSelection ( ) ) ;
296308 break ;
@@ -377,6 +389,10 @@ export class IgxGridStateDirective {
377389 return { rowPinning : pinned } ;
378390 }
379391
392+ private getPinningConfig ( ) : IGridState {
393+ return { pinningConfig : this . grid . pinning } ;
394+ }
395+
380396 private getColumnSelection ( ) : IGridState {
381397 const selection = this . grid . selectedColumns ( ) . map ( c => c . field ) ;
382398 return { columnSelection : selection } ;
@@ -465,6 +481,10 @@ export class IgxGridStateDirective {
465481 state . forEach ( rowID => this . grid . pinRow ( rowID ) ) ;
466482 }
467483
484+ private restorePinningConfig ( state : IPinningConfig ) {
485+ this . grid . pinning = state ;
486+ }
487+
468488 private restoreColumnSelection ( state : string [ ] ) {
469489 this . grid . selectColumns ( state ) ;
470490 }
0 commit comments