@@ -5573,7 +5573,7 @@ export abstract class IgxGridBaseDirective implements GridType,
55735573 /**
55745574 * @hidden @internal
55755575 */
5576- public getPossibleColumnWidth ( baseWidth : number = null , minColumnWidth : number = null ) {
5576+ public getPossibleColumnWidth ( baseWidth : number = null ) {
55775577 let computedWidth ;
55785578 if ( baseWidth !== null ) {
55795579 computedWidth = baseWidth ;
@@ -5620,13 +5620,12 @@ export abstract class IgxGridBaseDirective implements GridType,
56205620 if ( ! sumExistingWidths && ! columnsToSize ) {
56215621 return '0px' ;
56225622 }
5623- computedWidth -= this . featureColumnsWidth ( ) ;
56245623
5625- const minColWidth = minColumnWidth || this . minColumnWidth ;
5624+ computedWidth -= this . featureColumnsWidth ( ) ;
56265625
56275626 const columnWidth = ! Number . isFinite ( sumExistingWidths ) ?
5628- Math . max ( computedWidth / columnsToSize , minColWidth ) :
5629- Math . max ( ( computedWidth - sumExistingWidths ) / columnsToSize , minColWidth ) ;
5627+ computedWidth / columnsToSize :
5628+ ( computedWidth - sumExistingWidths ) / columnsToSize ;
56305629
56315630 return columnWidth + 'px' ;
56325631 }
@@ -6736,49 +6735,28 @@ export abstract class IgxGridBaseDirective implements GridType,
67366735 */
67376736 protected _derivePossibleWidth ( ) {
67386737 if ( ! this . columnWidthSetByUser ) {
6739- this . _columnWidth = this . width !== null ? this . getPossibleColumnWidth ( ) : this . minColumnWidth + 'px' ;
6738+ const possibleWidth = this . getPossibleColumnWidth ( ) ;
6739+ if ( possibleWidth === "0px" ) {
6740+ // all columns - hidden
6741+ this . _columnWidth = possibleWidth ;
6742+ } else if ( this . width !== null ) {
6743+ this . _columnWidth = Math . max ( parseFloat ( possibleWidth ) , this . minColumnWidth ) + 'px'
6744+ } else {
6745+ this . _columnWidth = this . minColumnWidth + 'px' ;
6746+ }
67406747 }
67416748 this . _columns . forEach ( ( column : IgxColumnComponent ) => {
67426749 if ( this . hasColumnLayouts && parseFloat ( this . _columnWidth ) ) {
67436750 const columnWidthCombined = parseFloat ( this . _columnWidth ) * ( column . colEnd ? column . colEnd - column . colStart : 1 ) ;
67446751 column . defaultWidth = columnWidthCombined + 'px' ;
67456752 } else {
6746- // D.K. March 29th, 2021 #9145 Consider min/max width when setting defaultWidth property
6747- column . defaultWidth = this . getExtremumBasedColWidth ( column ) ;
6753+ column . defaultWidth = this . _columnWidth ;
67486754 column . resetCaches ( ) ;
67496755 }
67506756 } ) ;
67516757 this . resetCachedWidths ( ) ;
67526758 }
67536759
6754- /**
6755- * @hidden
6756- * @internal
6757- */
6758- protected getExtremumBasedColWidth ( column : IgxColumnComponent ) : string {
6759- let width = this . _columnWidth ;
6760- if ( width && typeof width !== 'string' ) {
6761- width = String ( width ) ;
6762- }
6763- const minWidth = width . indexOf ( '%' ) === - 1 ? column . userSetMinWidthPx : column . minWidthPercent ;
6764- const maxWidth = width . indexOf ( '%' ) === - 1 ? column . maxWidthPx : column . maxWidthPercent ;
6765- if ( column . hidden ) {
6766- return width ;
6767- }
6768-
6769- if ( minWidth > parseFloat ( width ) ) {
6770- width = String ( column . minWidth ) ;
6771- } else if ( maxWidth < parseFloat ( width ) ) {
6772- width = String ( column . maxWidth ) ;
6773- }
6774-
6775- // if no px or % are defined in maxWidth/minWidth consider it px
6776- if ( width . indexOf ( '%' ) === - 1 && width . indexOf ( 'px' ) === - 1 ) {
6777- width += 'px' ;
6778- }
6779- return width ;
6780- }
6781-
67826760 protected resetNotifyChanges ( ) {
67836761 this . _cdrRequestRepaint = false ;
67846762 this . _cdrRequests = false ;
@@ -7072,13 +7050,6 @@ export abstract class IgxGridBaseDirective implements GridType,
70727050 this . cdr . detectChanges ( ) ;
70737051 }
70747052
7075- // in case horizontal scrollbar has appeared recalc to size correctly.
7076- if ( hasHScroll !== this . hasHorizontalScroll ( ) ) {
7077- this . isHorizontalScrollHidden = ! this . hasHorizontalScroll ( ) ;
7078- this . cdr . detectChanges ( ) ;
7079- this . calculateGridHeight ( ) ;
7080- this . cdr . detectChanges ( ) ;
7081- }
70827053 if ( this . zone . isStable ) {
70837054 this . zone . run ( ( ) => {
70847055 this . _applyWidthHostBinding ( ) ;
@@ -7098,6 +7069,16 @@ export abstract class IgxGridBaseDirective implements GridType,
70987069 this . _autoSizeColumnsNotify . next ( ) ;
70997070 } ) ;
71007071 }
7072+
7073+ // in case horizontal scrollbar has appeared recalc to size correctly.
7074+ if ( hasHScroll !== this . hasHorizontalScroll ( ) ) {
7075+ this . isHorizontalScrollHidden = ! this . hasHorizontalScroll ( ) ;
7076+ this . cdr . detectChanges ( ) ;
7077+ this . calculateGridHeight ( ) ;
7078+ this . cdr . detectChanges ( ) ;
7079+ } else {
7080+ this . resetCaches ( recalcFeatureWidth ) ;
7081+ }
71017082 }
71027083
71037084 /**
0 commit comments