File tree 2 files changed +29
-2
lines changed
projects/igniteui-angular/src/lib/grids/grid
2 files changed +29
-2
lines changed Original file line number Diff line number Diff line change @@ -103,10 +103,10 @@ export class IgxGridPagingPipe implements PipeTransform {
103
103
if ( ! this . gridAPI . grid . paging ) {
104
104
return collection ;
105
105
}
106
-
106
+ const _perPage = perPage - this . gridAPI . grid . pinnedRecords . length ;
107
107
const state = {
108
108
index : page ,
109
- recordsPerPage : perPage
109
+ recordsPerPage : _perPage
110
110
} ;
111
111
DataUtil . correctPagingState ( state , collection . data . length ) ;
112
112
Original file line number Diff line number Diff line change @@ -216,6 +216,33 @@ describe('Row Pinning #grid', () => {
216
216
expect ( grid . getRowByIndex ( 0 ) . rowID ) . toBe ( fix . componentInstance . data [ 0 ] ) ;
217
217
expect ( grid . getRowByIndex ( 1 ) . rowID ) . toBe ( fix . componentInstance . data [ 1 ] ) ;
218
218
} ) ;
219
+
220
+ it ( 'should page through unpinned collection with modified pageSize = pageSize - pinnedRows.lenght.' , ( ) => {
221
+ // pin 2nd row
222
+ grid . paging = true ;
223
+ grid . perPage = 5 ;
224
+ fix . detectChanges ( ) ;
225
+ let row = grid . getRowByIndex ( 1 ) ;
226
+ row . pin ( ) ;
227
+ fix . detectChanges ( ) ;
228
+
229
+ expect ( grid . pinnedRecords . length ) . toBe ( 1 ) ;
230
+ let pinRowContainer = fix . debugElement . queryAll ( By . css ( FIXED_ROW_CONTAINER ) ) ;
231
+ expect ( pinRowContainer . length ) . toBe ( 1 ) ;
232
+
233
+ expect ( grid . dataView . length ) . toBe ( 4 ) ;
234
+
235
+ // unpin
236
+ row = grid . getRowByIndex ( 0 ) ;
237
+ row . unpin ( ) ;
238
+ fix . detectChanges ( ) ;
239
+
240
+ expect ( grid . pinnedRecords . length ) . toBe ( 0 ) ;
241
+ pinRowContainer = fix . debugElement . queryAll ( By . css ( FIXED_ROW_CONTAINER ) ) ;
242
+ expect ( pinRowContainer . length ) . toBe ( 0 ) ;
243
+
244
+ expect ( grid . dataView . length ) . toBe ( 5 ) ;
245
+ } ) ;
219
246
} ) ;
220
247
} ) ;
221
248
You can’t perform that action at this time.
0 commit comments