@@ -111,7 +111,9 @@ export class IgxColumnResizingService {
111
111
const actualWidth = this . column . headerCell . elementRef . nativeElement . getBoundingClientRect ( ) . width ;
112
112
currentColWidth = Number . isNaN ( currentColWidth ) ? parseFloat ( actualWidth ) : currentColWidth ;
113
113
114
- if ( isPercentageWidth ) {
114
+ if ( this . column . grid . hasColumnLayouts ) {
115
+ this . resizeColumnLayoutFor ( this . column , diff ) ;
116
+ } else if ( isPercentageWidth ) {
115
117
this . _handlePercentageResize ( diff , this . column ) ;
116
118
} else {
117
119
this . _handlePixelResize ( diff , this . column ) ;
@@ -133,21 +135,17 @@ export class IgxColumnResizingService {
133
135
134
136
protected _handlePixelResize ( diff : number , column : IgxColumnComponent ) {
135
137
let currentColWidth = parseFloat ( column . width ) ;
136
- const actualWidth = this . column . headerCell . elementRef . nativeElement . getBoundingClientRect ( ) . width ;
138
+ const actualWidth = column . headerCell . elementRef . nativeElement . getBoundingClientRect ( ) . width ;
137
139
currentColWidth = Number . isNaN ( currentColWidth ) || ( currentColWidth < actualWidth ) ? actualWidth : currentColWidth ;
138
140
139
141
const colMinWidth = column . minWidthPx ;
140
142
const colMaxWidth = column . maxWidthPx ;
141
- if ( this . column . grid . hasColumnLayouts ) {
142
- this . resizeColumnLayoutFor ( this . column , diff ) ;
143
+ if ( currentColWidth + diff < colMinWidth ) {
144
+ column . width = colMinWidth + 'px' ;
145
+ } else if ( colMaxWidth && ( currentColWidth + diff > colMaxWidth ) ) {
146
+ column . width = colMaxWidth + 'px' ;
143
147
} else {
144
- if ( currentColWidth + diff < colMinWidth ) {
145
- this . column . width = colMinWidth + 'px' ;
146
- } else if ( colMaxWidth && ( currentColWidth + diff > colMaxWidth ) ) {
147
- this . column . width = colMaxWidth + 'px' ;
148
- } else {
149
- this . column . width = ( currentColWidth + diff ) + 'px' ;
150
- }
148
+ column . width = ( currentColWidth + diff ) + 'px' ;
151
149
}
152
150
}
153
151
@@ -160,11 +158,11 @@ export class IgxColumnResizingService {
160
158
const colMaxWidth = column . maxWidthPercent ;
161
159
162
160
if ( currentPercentWidth + diffPercentage < colMinWidth ) {
163
- this . column . width = colMinWidth + '%' ;
161
+ column . width = colMinWidth + '%' ;
164
162
} else if ( colMaxWidth && ( currentPercentWidth + diffPercentage > colMaxWidth ) ) {
165
- this . column . width = colMaxWidth + '%' ;
163
+ column . width = colMaxWidth + '%' ;
166
164
} else {
167
- this . column . width = ( currentPercentWidth + diffPercentage ) + '%' ;
165
+ column . width = ( currentPercentWidth + diffPercentage ) + '%' ;
168
166
}
169
167
}
170
168
@@ -196,16 +194,18 @@ export class IgxColumnResizingService {
196
194
columnsToResize . forEach ( ( col ) => {
197
195
const currentResizeWidth = parseFloat ( col . target . calcWidth ) ;
198
196
const resizeScaled = ( diff / updatedCombinedSpan ) * col . target . gridColumnSpan ;
197
+ const colWidth = col . target . width ;
198
+ const isPercentageWidth = colWidth && typeof colWidth === 'string' && colWidth . indexOf ( '%' ) !== - 1 ;
199
199
200
- const minWidth = this . getColMinWidth ( col . target ) ;
201
- const maxWidth = parseFloat ( col . target . maxWidth ) ;
200
+ const minWidth = col . target . minWidthPx ;
201
+ const maxWidth = col . target . maxWidthPx ;
202
202
if ( currentResizeWidth + resizeScaled < minWidth ) {
203
- col . target . width = minWidth + 'px' ;
203
+ col . target . width = isPercentageWidth ? col . target . minWidthPercent + '%' : minWidth + 'px' ;
204
204
updatedDiff += ( currentResizeWidth - minWidth ) ;
205
205
newCombinedSpan -= col . spanUsed ;
206
206
setMinMaxCols = true ;
207
207
} else if ( maxWidth && ( currentResizeWidth + resizeScaled > maxWidth ) ) {
208
- col . target . width = maxWidth + 'px' ;
208
+ col . target . width = isPercentageWidth ? col . target . maxWidthPercent + '%' : col . target . maxWidthPx + 'px' ;
209
209
updatedDiff -= ( maxWidth - currentResizeWidth ) ;
210
210
newCombinedSpan -= col . spanUsed ;
211
211
setMinMaxCols = true ;
@@ -221,9 +221,14 @@ export class IgxColumnResizingService {
221
221
222
222
// Those left that don't reach min/max size resize them normally.
223
223
columnsToResize . forEach ( ( col ) => {
224
- const currentResizeWidth = parseFloat ( col . target . calcWidth ) ;
225
224
const resizeScaled = ( updatedDiff / updatedCombinedSpan ) * col . target . gridColumnSpan ;
226
- col . target . width = ( currentResizeWidth + resizeScaled ) + 'px' ;
225
+ const colWidth = col . target . width ;
226
+ const isPercentageWidth = colWidth && typeof colWidth === 'string' && colWidth . indexOf ( '%' ) !== - 1 ;
227
+ if ( isPercentageWidth ) {
228
+ this . _handlePercentageResize ( resizeScaled , col . target ) ;
229
+ } else {
230
+ this . _handlePixelResize ( resizeScaled , col . target ) ;
231
+ }
227
232
} ) ;
228
233
}
229
234
}
0 commit comments