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 @@ -6081,13 +6081,42 @@ export abstract class IgxGridBaseDirective extends DisplayDensityBase implements
60816081 const columnWidthCombined = parseInt ( this . _columnWidth , 10 ) * ( column . colEnd ? column . colEnd - column . colStart : 1 ) ;
60826082 column . defaultWidth = columnWidthCombined + 'px' ;
60836083 } else {
6084- column . defaultWidth = this . _columnWidth ;
6084+ // D.K. March 29th, 2021 #9145 Consider min/max width when setting defaultWidth property
6085+ column . defaultWidth = this . getExtremumBasedColWidth ( column ) ;
60856086 column . resetCaches ( ) ;
60866087 }
60876088 } ) ;
60886089 this . resetCachedWidths ( ) ;
60896090 }
60906091
6092+ /**
6093+ * @hidden
6094+ * @internal
6095+ */
6096+ protected getExtremumBasedColWidth ( column : IgxColumnComponent ) : string {
6097+ let width = this . _columnWidth ;
6098+ if ( width && typeof width !== 'string' ) {
6099+ width = String ( width ) ;
6100+ }
6101+ const minWidth = width . indexOf ( '%' ) === - 1 ? column . minWidthPx : column . minWidthPercent ;
6102+ const maxWidth = width . indexOf ( '%' ) === - 1 ? column . maxWidthPx : column . maxWidthPercent ;
6103+ if ( column . hidden ) {
6104+ return width ;
6105+ }
6106+
6107+ if ( minWidth > parseFloat ( width ) ) {
6108+ width = String ( column . minWidth ) ;
6109+ } else if ( maxWidth < parseFloat ( width ) ) {
6110+ width = String ( column . maxWidth ) ;
6111+ }
6112+
6113+ // if no px or % are defined in maxWidth/minWidth consider it px
6114+ if ( width . indexOf ( '%' ) === - 1 && width . indexOf ( 'px' ) === - 1 ) {
6115+ width += 'px' ;
6116+ }
6117+ return width ;
6118+ }
6119+
60916120 protected resetNotifyChanges ( ) {
60926121 this . _cdrRequestRepaint = false ;
60936122 this . _cdrRequests = false ;
You can’t perform that action at this time.
0 commit comments