@@ -31,6 +31,7 @@ import {
3131 updateState ,
3232} from './vaadin-grid-helpers.js' ;
3333import { KeyboardNavigationMixin } from './vaadin-grid-keyboard-navigation-mixin.js' ;
34+ import { ResizeMixin } from './vaadin-grid-resize-mixin.js' ;
3435import { RowDetailsMixin } from './vaadin-grid-row-details-mixin.js' ;
3536import { ScrollMixin } from './vaadin-grid-scroll-mixin.js' ;
3637import { SelectionMixin } from './vaadin-grid-selection-mixin.js' ;
@@ -57,6 +58,7 @@ import { StylingMixin } from './vaadin-grid-styling-mixin.js';
5758 * @mixes EventContextMixin
5859 * @mixes StylingMixin
5960 * @mixes DragAndDropMixin
61+ * @mixes ResizeMixin
6062 */
6163export const GridMixin = ( superClass ) =>
6264 class extends ColumnAutoWidthMixin (
@@ -73,7 +75,7 @@ export const GridMixin = (superClass) =>
7375 FilterMixin (
7476 ColumnReorderingMixin (
7577 ColumnResizingMixin (
76- EventContextMixin ( DragAndDropMixin ( StylingMixin ( TabindexMixin ( superClass ) ) ) ) ,
78+ EventContextMixin ( DragAndDropMixin ( StylingMixin ( TabindexMixin ( ResizeMixin ( superClass ) ) ) ) ) ,
7779 ) ,
7880 ) ,
7981 ) ,
@@ -263,25 +265,6 @@ export const GridMixin = (superClass) =>
263265 __disableHeightPlaceholder : true ,
264266 } ) ;
265267
266- new ResizeObserver ( ( ) => {
267- setTimeout ( ( ) => {
268- this . __updateColumnsBodyContentHidden ( ) ;
269- } ) ;
270- // Updating data can change the visibility of the scroll bar. Therefore,
271- // the scroll position has to be recalculated.
272- this . __updateHorizontalScrollPosition ( ) ;
273- } ) . observe ( this . $ . table ) ;
274-
275- const minHeightObserver = new ResizeObserver ( ( ) =>
276- setTimeout ( ( ) => {
277- this . __updateMinHeight ( ) ;
278- } ) ,
279- ) ;
280-
281- minHeightObserver . observe ( this . $ . header ) ;
282- minHeightObserver . observe ( this . $ . items ) ;
283- minHeightObserver . observe ( this . $ . footer ) ;
284-
285268 this . _tooltipController = new TooltipController ( this ) ;
286269 this . addController ( this . _tooltipController ) ;
287270 this . _tooltipController . setManual ( true ) ;
@@ -292,6 +275,23 @@ export const GridMixin = (superClass) =>
292275 } ) ;
293276 }
294277
278+ /** @protected */
279+ updated ( props ) {
280+ super . updated ( props ) ;
281+
282+ if ( props . has ( '__headerRect' ) || props . has ( '__footerRect' ) || props . has ( '__itemsRect' ) ) {
283+ setTimeout ( ( ) => this . __updateMinHeight ( ) ) ;
284+ }
285+
286+ if ( props . has ( '__tableRect' ) ) {
287+ setTimeout ( ( ) => this . __updateColumnsBodyContentHidden ( ) ) ;
288+
289+ // Updating data can change the visibility of the scroll bar. Therefore,
290+ // the scroll position has to be recalculated.
291+ this . __updateHorizontalScrollPosition ( ) ;
292+ }
293+ }
294+
295295 /** @private */
296296 __getBodyCellCoordinates ( cell ) {
297297 if ( this . $ . items . contains ( cell ) && cell . localName === 'td' ) {
0 commit comments