@@ -147,6 +147,7 @@ import { IgxColumnComponent } from './columns/column.component';
147147import { IgxColumnGroupComponent } from './columns/column-group.component' ;
148148import { IGridSortingStrategy } from '../data-operations/sorting-strategy' ;
149149import { IgxRowDragGhostDirective , IgxDragIndicatorIconDirective } from './row-drag.directive' ;
150+ import { isNumber } from 'util' ;
150151
151152const MINIMUM_COLUMN_WIDTH = 136 ;
152153const FILTER_ROW_HEIGHT = 50 ;
@@ -1747,8 +1748,8 @@ export class IgxGridBaseDirective extends DisplayDensityBase implements
17471748 /**
17481749 * @hidden @internal
17491750 */
1750- @ViewChild ( 'pinContainer' , { static : false } )
1751- public pinContainer : ElementRef ;
1751+ @ViewChildren ( 'pinContainer' , { read : ElementRef } )
1752+ public pinContainers : QueryList < ElementRef > ;
17521753
17531754 /**
17541755 * @hidden @internal
@@ -2410,6 +2411,9 @@ export class IgxGridBaseDirective extends DisplayDensityBase implements
24102411 */
24112412 protected destroy$ = new Subject < any > ( ) ;
24122413
2414+ protected _filteredPinnedData ;
2415+ protected _filteredUnpinnedData ;
2416+
24132417 /**
24142418 * @hidden
24152419 */
@@ -2670,6 +2674,14 @@ export class IgxGridBaseDirective extends DisplayDensityBase implements
26702674 return this . _pinnedRecordIDs . length > 0 ;
26712675 }
26722676
2677+ /**
2678+ * @hidden
2679+ * @internal
2680+ */
2681+ public get pinnedRecordsCount ( ) {
2682+ return this . _pinnedRecordIDs . length ;
2683+ }
2684+
26732685 private keydownHandler = ( event ) => {
26742686 const key = event . key . toLowerCase ( ) ;
26752687 if ( ( isNavigationKey ( key ) && event . keyCode !== 32 ) || key === 'tab' || key === 'pagedown' || key === 'pageup' ) {
@@ -2816,6 +2828,10 @@ export class IgxGridBaseDirective extends DisplayDensityBase implements
28162828 this . endEdit ( true ) ;
28172829 this . cdr . markForCheck ( ) ;
28182830 } ) ;
2831+
2832+ this . onRowPinning . subscribe ( ( ) => {
2833+ this . summaryService . clearSummaryCache ( ) ;
2834+ } ) ;
28192835 }
28202836
28212837 /**
@@ -2865,6 +2881,17 @@ export class IgxGridBaseDirective extends DisplayDensityBase implements
28652881 }
28662882 }
28672883
2884+ public setFilterData ( data , pinned : boolean ) {
2885+ if ( this . hasPinnedRecords && pinned ) {
2886+ this . _filteredPinnedData = data ;
2887+ this . filteredData = [ ... this . _filteredPinnedData , ... this . _filteredUnpinnedData ] ;
2888+ } else if ( this . hasPinnedRecords && ! pinned ) {
2889+ this . _filteredUnpinnedData = data ;
2890+ } else {
2891+ this . filteredData = data ;
2892+ }
2893+ }
2894+
28682895 /**
28692896 * @hidden
28702897 * @internal
@@ -2956,6 +2983,12 @@ export class IgxGridBaseDirective extends DisplayDensityBase implements
29562983 vertScrDC . addEventListener ( 'scroll' , this . scrollHandler ) ;
29572984 vertScrDC . addEventListener ( 'wheel' , ( ) => this . wheelHandler ( ) ) ;
29582985
2986+ this . pinContainers . changes . subscribe ( ( c ) => {
2987+ if ( this . hasPinnedRecords ) {
2988+ // on row pin containers change grid sizes should be recalculated.
2989+ this . calculateGridSizes ( ) ;
2990+ }
2991+ } ) ;
29592992 }
29602993
29612994 /**
@@ -3080,6 +3113,7 @@ export class IgxGridBaseDirective extends DisplayDensityBase implements
30803113 public set expansionStates ( value ) {
30813114 this . _expansionStates = new Map < any , boolean > ( value ) ;
30823115 this . expansionStatesChange . emit ( this . _expansionStates ) ;
3116+ this . notifyChanges ( true ) ;
30833117 if ( this . gridAPI . grid ) {
30843118 this . cdr . detectChanges ( ) ;
30853119 }
@@ -4099,7 +4133,8 @@ export class IgxGridBaseDirective extends DisplayDensityBase implements
40994133
41004134 this . endEdit ( true ) ;
41014135
4102- this . _pinnedRecordIDs . splice ( eventArgs . insertAtIndex || this . _pinnedRecordIDs . length , 0 , rowID ) ;
4136+ const insertIndex = isNumber ( eventArgs . insertAtIndex ) ? eventArgs . insertAtIndex : this . _pinnedRecordIDs . length ;
4137+ this . _pinnedRecordIDs . splice ( insertIndex , 0 , rowID ) ;
41034138 this . _pipeTrigger ++ ;
41044139 if ( this . gridAPI . grid ) {
41054140 this . notifyChanges ( true ) ;
@@ -4139,8 +4174,9 @@ export class IgxGridBaseDirective extends DisplayDensityBase implements
41394174 }
41404175
41414176 get pinnedRowHeight ( ) {
4142- const containerHeight = this . pinContainer ? this . pinContainer . nativeElement . offsetHeight : 0 ;
4143- return this . _pinnedRecordIDs . length > 0 ? containerHeight : 0 ;
4177+ const pinContainer = this . pinContainers && this . pinContainers . length > 0 ? this . pinContainers . first : null ;
4178+ const containerHeight = pinContainer ? pinContainer . nativeElement . offsetHeight : 0 ;
4179+ return this . hasPinnedRecords ? containerHeight : 0 ;
41444180 }
41454181
41464182 get totalHeight ( ) {
0 commit comments