Skip to content

Commit 4e2a3d1

Browse files
committed
Merge master into SKrastev/row-pinning-nav
2 parents b53bd1f + 1357bcb commit 4e2a3d1

File tree

4 files changed

+27
-7
lines changed

4 files changed

+27
-7
lines changed

projects/igniteui-angular/src/lib/grids/api.service.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,9 @@ export class GridBaseAPIService <T extends IgxGridBaseDirective & GridType> {
3434
public get_summary_data() {
3535
const grid = this.grid;
3636
let data = grid.filteredData;
37+
if (data && grid.hasPinnedRecords) {
38+
data = grid._filteredUnpinnedData;
39+
}
3740
if (!data) {
3841
if (grid.transactions.enabled) {
3942
data = DataUtil.mergeTransactions(

projects/igniteui-angular/src/lib/grids/grid-base.directive.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2462,7 +2462,11 @@ export class IgxGridBaseDirective extends DisplayDensityBase implements
24622462
protected _filteredSortedPinnedData;
24632463
protected _filteredSortedUnpinnedData;
24642464
protected _filteredPinnedData;
2465-
protected _filteredUnpinnedData;
2465+
2466+
/**
2467+
* @hidden
2468+
*/
2469+
public _filteredUnpinnedData;
24662470

24672471
/**
24682472
* @hidden
@@ -2890,10 +2894,6 @@ export class IgxGridBaseDirective extends DisplayDensityBase implements
28902894
this.summaryService.summaryHeight = 0;
28912895
this.notifyChanges(true);
28922896
});
2893-
2894-
this.onRowPinning.subscribe(() => {
2895-
this.summaryService.clearSummaryCache();
2896-
});
28972897
}
28982898

28992899
/**

projects/igniteui-angular/src/lib/grids/grid/grid-row-pinning.spec.ts

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -359,6 +359,23 @@ describe('Row Pinning #grid', () => {
359359
expect(pinRowContainer[0].children[0].context.rowID).toBe(fix.componentInstance.data[4]);
360360
});
361361

362+
it('should calculate global summaries correctly when filtering is applied.', () => {
363+
grid.getColumnByName('ID').hasSummary = true;
364+
fix.detectChanges();
365+
grid.filter('ID', 'BERGS', IgxStringFilteringOperand.instance().condition('contains'), false);
366+
fix.detectChanges();
367+
368+
let summaryRow = GridSummaryFunctions.getRootSummaryRow(fix);
369+
GridSummaryFunctions.verifyColumnSummaries(summaryRow, 0, ['Count'], ['1']);
370+
371+
// pin row
372+
grid.getRowByIndex(0).pin();
373+
fix.detectChanges();
374+
375+
summaryRow = GridSummaryFunctions.getRootSummaryRow(fix);
376+
GridSummaryFunctions.verifyColumnSummaries(summaryRow, 0, ['Count'], ['1']);
377+
});
378+
362379
it('should remove pinned container and recalculate sizes when all pinned records are filtered out.', () => {
363380
grid.getRowByIndex(1).pin();
364381
fix.detectChanges();

src/app/grid-row-pinning/grid-row-pinning.sample.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@
4646
</igx-column>
4747
<igx-column *ngFor="let c of columns" [sortable]="true" [field]="c.field" [header]="c.field"
4848
[width]="c.width" [pinned]='c.pinned' [groupable]='c.groupable' [hidden]='c.hidden'
49-
[editable]='true'>
49+
[editable]='true' [hasSummary]='true'>
5050
</igx-column>
5151
</igx-grid>
5252
</div>
@@ -70,7 +70,7 @@
7070
<button (click)="hGrid.deleteRow(cell.cellID.rowID)">Delete</button>
7171
</ng-template>
7272
</igx-column>
73-
<igx-column *ngFor="let c of hColumns" [editable]="true" [sortable]="true" [field]="c.field" [header]="c.field" [width]="c.width" [pinned]='c.pinned' [groupable]='c.groupable' >
73+
<igx-column *ngFor="let c of hColumns" [hasSummary]='true' [editable]="true" [sortable]="true" [field]="c.field" [header]="c.field" [width]="c.width" [pinned]='c.pinned' [groupable]='c.groupable' >
7474
</igx-column>
7575
<igx-row-island [key]="'childData'" [autoGenerate]="true" [rowSelectable]='true' [allowFiltering]='true' >
7676
<igx-row-island [key]="'childData'" [autoGenerate]="true" [rowSelectable]='true' [allowFiltering]='true'></igx-row-island>

0 commit comments

Comments
 (0)