File tree Expand file tree Collapse file tree 1 file changed +30
-1
lines changed
projects/igniteui-angular/src/lib/grids Expand file tree Collapse file tree 1 file changed +30
-1
lines changed Original file line number Diff line number Diff line change @@ -4826,13 +4826,42 @@ export abstract class IgxGridBaseDirective extends DisplayDensityBase implements
48264826 const columnWidthCombined = parseInt ( this . _columnWidth , 10 ) * ( column . colEnd ? column . colEnd - column . colStart : 1 ) ;
48274827 column . defaultWidth = columnWidthCombined + 'px' ;
48284828 } else {
4829- column . defaultWidth = this . _columnWidth ;
4829+ // D.K. March 29th, 2021 #9145 Consider min/max width when setting defaultWidth property
4830+ column . defaultWidth = this . getExtremumBasedColWidth ( column ) ;
48304831 column . resetCaches ( ) ;
48314832 }
48324833 } ) ;
48334834 this . resetCachedWidths ( ) ;
48344835 }
48354836
4837+ /**
4838+ * @hidden
4839+ * @internal
4840+ */
4841+ protected getExtremumBasedColWidth ( column : IgxColumnComponent ) : string {
4842+ let width = this . _columnWidth ;
4843+ if ( width && typeof width !== 'string' ) {
4844+ width = String ( width ) ;
4845+ }
4846+ const minWidth = width . indexOf ( '%' ) === - 1 ? column . minWidthPx : column . minWidthPercent ;
4847+ const maxWidth = width . indexOf ( '%' ) === - 1 ? column . maxWidthPx : column . maxWidthPercent ;
4848+ if ( column . hidden ) {
4849+ return width ;
4850+ }
4851+
4852+ if ( minWidth > parseFloat ( width ) ) {
4853+ width = String ( column . minWidth ) ;
4854+ } else if ( maxWidth < parseFloat ( width ) ) {
4855+ width = String ( column . maxWidth ) ;
4856+ }
4857+
4858+ // if no px or % are defined in maxWidth/minWidth consider it px
4859+ if ( width . indexOf ( '%' ) === - 1 && width . indexOf ( 'px' ) === - 1 ) {
4860+ width += 'px' ;
4861+ }
4862+ return width ;
4863+ }
4864+
48364865 /**
48374866 * @hidden
48384867 */
You can’t perform that action at this time.
0 commit comments