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 @@ -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 ;
You can’t perform that action at this time.
0 commit comments