Skip to content

Commit

Permalink
refactor(pivot): move date dimension enabled set on init (#14754)
Browse files Browse the repository at this point in the history
  • Loading branch information
damyanpetev authored Sep 16, 2024
1 parent ad1d52c commit c59cdfe
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,6 @@ export class IgxPivotDateDimension implements IPivotDimension {
constructor(inBaseDimension: IPivotDimension = null, inOptions: IPivotDateDimensionOptions = {}) {
this._baseDimension = inBaseDimension;
this._options = inOptions;
this.enabled = inBaseDimension?.enabled;
if (this.baseDimension && this.options) {
this.initialize(this.baseDimension, this.options);
}
Expand All @@ -140,6 +139,7 @@ export class IgxPivotDateDimension implements IPivotDimension {
this.dataType = GridColumnDataType.Date;
inBaseDimension.dataType = GridColumnDataType.Date;

this.enabled = inBaseDimension.enabled;
this.displayName = inBaseDimension.displayName || this.resourceStrings.igx_grid_pivot_date_dimension_total;

const baseDimension = options.fullDate ? inBaseDimension : null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2016,8 +2016,6 @@ describe('IgxPivotGrid #pivotGrid', () => {
it('should allow creating IgxPivotDateDimension with no base dimension and setting it later.', () => {
const pivotGrid = fixture.componentInstance.pivotGrid;
const dateDimension = new IgxPivotDateDimension();
dateDimension.memberName = 'Date';
dateDimension.enabled = true;
dateDimension.baseDimension = {
memberName: 'Date',
enabled: true,
Expand All @@ -2029,6 +2027,9 @@ describe('IgxPivotGrid #pivotGrid', () => {
years: true,
quarters: false
}

expect(dateDimension.enabled).toBe(true);

pivotGrid.pivotConfiguration.rows = [dateDimension];
pivotGrid.pipeTrigger++;
fixture.detectChanges();
Expand Down

0 comments on commit c59cdfe

Please sign in to comment.