Skip to content

Commit 170c071

Browse files
authored
Merge branch 'master' into clear-active-node-summary
2 parents 6778128 + 3ac3c5b commit 170c071

File tree

1 file changed

+30
-1
lines changed

1 file changed

+30
-1
lines changed

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

Lines changed: 30 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6082,13 +6082,42 @@ export abstract class IgxGridBaseDirective extends DisplayDensityBase implements
60826082
const columnWidthCombined = parseInt(this._columnWidth, 10) * (column.colEnd ? column.colEnd - column.colStart : 1);
60836083
column.defaultWidth = columnWidthCombined + 'px';
60846084
} else {
6085-
column.defaultWidth = this._columnWidth;
6085+
// D.K. March 29th, 2021 #9145 Consider min/max width when setting defaultWidth property
6086+
column.defaultWidth = this.getExtremumBasedColWidth(column);
60866087
column.resetCaches();
60876088
}
60886089
});
60896090
this.resetCachedWidths();
60906091
}
60916092

6093+
/**
6094+
* @hidden
6095+
* @internal
6096+
*/
6097+
protected getExtremumBasedColWidth(column: IgxColumnComponent): string {
6098+
let width = this._columnWidth;
6099+
if (width && typeof width !== 'string') {
6100+
width = String(width);
6101+
}
6102+
const minWidth = width.indexOf('%') === -1 ? column.minWidthPx : column.minWidthPercent;
6103+
const maxWidth = width.indexOf('%') === -1 ? column.maxWidthPx : column.maxWidthPercent;
6104+
if (column.hidden) {
6105+
return width;
6106+
}
6107+
6108+
if (minWidth > parseFloat(width)) {
6109+
width = String(column.minWidth);
6110+
} else if (maxWidth < parseFloat(width)) {
6111+
width = String(column.maxWidth);
6112+
}
6113+
6114+
// if no px or % are defined in maxWidth/minWidth consider it px
6115+
if (width.indexOf('%') === -1 && width.indexOf('px') === -1) {
6116+
width += 'px';
6117+
}
6118+
return width;
6119+
}
6120+
60926121
protected resetNotifyChanges() {
60936122
this._cdrRequestRepaint = false;
60946123
this._cdrRequests = false;

0 commit comments

Comments
 (0)