Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { Subject } from 'rxjs';
import { isEqual } from 'lodash-es';
import {
AfterContentInit,
ChangeDetectorRef,
Expand Down Expand Up @@ -1090,12 +1091,16 @@ export class IgxColumnComponent implements AfterContentInit, OnDestroy, ColumnTy
*
* @memberof IgxColumnComponent
*/
@WatchColumnChanges()
@Input()
public get disabledSummaries(): string[] {
return this._disabledSummaries;
}

public set disabledSummaries(value: string[]) {
if (isEqual(this._disabledSummaries, value)) {
return;
}
this._disabledSummaries = value;
if (this.grid) {
this.grid.summaryService.removeSummariesCachePerColumn(this.field);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -160,9 +160,6 @@ describe('IgxGrid - Summaries #grid', () => {

const column = grid.getColumnByName('UnitsInStock');

column.disabledSummaries = [];
fixture.detectChanges();
tick();
GridSummaryFunctions.verifyColumnSummaries(
GridSummaryFunctions.getRootSummaryRow(fixture), 3,
['Count', 'Min', 'Max', 'Sum', 'Avg'],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1085,6 +1085,40 @@ describe('Basic IgxHierarchicalGrid #hGrid', () => {
expect(childGrid1.columns[0].editable).toBeTrue();
expect(childGrid1.columns[1].editable).toBeTrue();
});

it('should update the row island summary UI when disabledSummaries is changed at runtime', fakeAsync(() => {
const masterRow = hierarchicalGrid.gridAPI.get_row_by_index(0) as IgxHierarchicalRowComponent;
UIInteractions.simulateClickAndSelectEvent(masterRow.expander);
fixture.detectChanges();

const childGrid = hierarchicalGrid.gridAPI.getChildGrids(false)[0] as IgxHierarchicalGridComponent;
fixture.detectChanges();

childGrid.columns.forEach(c => c.hasSummary = true);
fixture.detectChanges();
tick();

const column = childGrid.columns.find(c => c.field === 'ProductName');
expect(column).toBeDefined();
fixture.detectChanges();
tick();

const summaryCells = childGrid.nativeElement.querySelectorAll('igx-grid-summary-cell');
const summaryCell = summaryCells[1];

expect(summaryCell).toBeDefined();
expect(summaryCell.textContent.trim().length).toBeGreaterThan(0);

const getterSpy = spyOnProperty(column, 'disabledSummaries', 'get').and.callThrough();

column.disabledSummaries = ['count'];
fixture.detectChanges();
tick();
fixture.detectChanges();

expect(getterSpy).toHaveBeenCalledTimes(7);
expect(summaryCell.textContent.trim()).toEqual('');
}));
});

describe('IgxHierarchicalGrid Children Sizing #hGrid', () => {
Expand Down
Loading