@@ -5667,7 +5667,7 @@ export abstract class IgxGridBaseDirective implements GridType,
56675667 /**
56685668 * @hidden @internal
56695669 */
5670- public getPossibleColumnWidth ( baseWidth : number = null , minColumnWidth : number = null ) {
5670+ public getPossibleColumnWidth ( baseWidth : number = null ) {
56715671 let computedWidth ;
56725672 if ( baseWidth !== null ) {
56735673 computedWidth = baseWidth ;
@@ -5714,13 +5714,12 @@ export abstract class IgxGridBaseDirective implements GridType,
57145714 if ( ! sumExistingWidths && ! columnsToSize ) {
57155715 return '0px' ;
57165716 }
5717- computedWidth -= this . featureColumnsWidth ( ) ;
57185717
5719- const minColWidth = minColumnWidth || this . minColumnWidth ;
5718+ computedWidth -= this . featureColumnsWidth ( ) ;
57205719
57215720 const columnWidth = ! Number . isFinite ( sumExistingWidths ) ?
5722- Math . max ( computedWidth / columnsToSize , minColWidth ) :
5723- Math . max ( ( computedWidth - sumExistingWidths ) / columnsToSize , minColWidth ) ;
5721+ computedWidth / columnsToSize :
5722+ ( computedWidth - sumExistingWidths ) / columnsToSize ;
57245723
57255724 return columnWidth + 'px' ;
57265725 }
@@ -6830,49 +6829,28 @@ export abstract class IgxGridBaseDirective implements GridType,
68306829 */
68316830 protected _derivePossibleWidth ( ) {
68326831 if ( ! this . columnWidthSetByUser ) {
6833- this . _columnWidth = this . width !== null ? this . getPossibleColumnWidth ( ) : this . minColumnWidth + 'px' ;
6832+ const possibleWidth = this . getPossibleColumnWidth ( ) ;
6833+ if ( possibleWidth === "0px" ) {
6834+ // all columns - hidden
6835+ this . _columnWidth = possibleWidth ;
6836+ } else if ( this . width !== null ) {
6837+ this . _columnWidth = Math . max ( parseFloat ( possibleWidth ) , this . minColumnWidth ) + 'px'
6838+ } else {
6839+ this . _columnWidth = this . minColumnWidth + 'px' ;
6840+ }
68346841 }
68356842 this . _columns . forEach ( ( column : IgxColumnComponent ) => {
68366843 if ( this . hasColumnLayouts && parseFloat ( this . _columnWidth ) ) {
68376844 const columnWidthCombined = parseFloat ( this . _columnWidth ) * ( column . colEnd ? column . colEnd - column . colStart : 1 ) ;
68386845 column . defaultWidth = columnWidthCombined + 'px' ;
68396846 } else {
6840- // D.K. March 29th, 2021 #9145 Consider min/max width when setting defaultWidth property
6841- column . defaultWidth = this . getExtremumBasedColWidth ( column ) ;
6847+ column . defaultWidth = this . _columnWidth ;
68426848 column . resetCaches ( ) ;
68436849 }
68446850 } ) ;
68456851 this . resetCachedWidths ( ) ;
68466852 }
68476853
6848- /**
6849- * @hidden
6850- * @internal
6851- */
6852- protected getExtremumBasedColWidth ( column : IgxColumnComponent ) : string {
6853- let width = this . _columnWidth ;
6854- if ( width && typeof width !== 'string' ) {
6855- width = String ( width ) ;
6856- }
6857- const minWidth = width . indexOf ( '%' ) === - 1 ? column . userSetMinWidthPx : column . minWidthPercent ;
6858- const maxWidth = width . indexOf ( '%' ) === - 1 ? column . maxWidthPx : column . maxWidthPercent ;
6859- if ( column . hidden ) {
6860- return width ;
6861- }
6862-
6863- if ( minWidth > parseFloat ( width ) ) {
6864- width = String ( column . minWidth ) ;
6865- } else if ( maxWidth < parseFloat ( width ) ) {
6866- width = String ( column . maxWidth ) ;
6867- }
6868-
6869- // if no px or % are defined in maxWidth/minWidth consider it px
6870- if ( width . indexOf ( '%' ) === - 1 && width . indexOf ( 'px' ) === - 1 ) {
6871- width += 'px' ;
6872- }
6873- return width ;
6874- }
6875-
68766854 protected resetNotifyChanges ( ) {
68776855 this . _cdrRequestRepaint = false ;
68786856 this . _cdrRequests = false ;
@@ -7166,13 +7144,6 @@ export abstract class IgxGridBaseDirective implements GridType,
71667144 this . cdr . detectChanges ( ) ;
71677145 }
71687146
7169- // in case horizontal scrollbar has appeared recalc to size correctly.
7170- if ( hasHScroll !== this . hasHorizontalScroll ( ) ) {
7171- this . isHorizontalScrollHidden = ! this . hasHorizontalScroll ( ) ;
7172- this . cdr . detectChanges ( ) ;
7173- this . calculateGridHeight ( ) ;
7174- this . cdr . detectChanges ( ) ;
7175- }
71767147 if ( this . zone . isStable ) {
71777148 this . zone . run ( ( ) => {
71787149 this . _applyWidthHostBinding ( ) ;
@@ -7192,6 +7163,16 @@ export abstract class IgxGridBaseDirective implements GridType,
71927163 this . _autoSizeColumnsNotify . next ( ) ;
71937164 } ) ;
71947165 }
7166+
7167+ // in case horizontal scrollbar has appeared recalc to size correctly.
7168+ if ( hasHScroll !== this . hasHorizontalScroll ( ) ) {
7169+ this . isHorizontalScrollHidden = ! this . hasHorizontalScroll ( ) ;
7170+ this . cdr . detectChanges ( ) ;
7171+ this . calculateGridHeight ( ) ;
7172+ this . cdr . detectChanges ( ) ;
7173+ } else {
7174+ this . resetCaches ( recalcFeatureWidth ) ;
7175+ }
71957176 }
71967177
71977178 /**
0 commit comments