File tree Expand file tree Collapse file tree 1 file changed +15
-6
lines changed
src/main/resources/META-INF/frontend/fcGridHelper Expand file tree Collapse file tree 1 file changed +15
-6
lines changed Original file line number Diff line number Diff line change 22 * #%L
33 * Grid Helpers Add-on
44 * %%
5- * Copyright (C) 2022 - 2024 Flowing Code
5+ * Copyright (C) 2022 - 2026 Flowing Code
66 * %%
77 * Licensed under the Apache License, Version 2.0 (the "License");
88 * you may not use this file except in compliance with the License.
@@ -64,13 +64,22 @@ import { Grid } from '@vaadin/grid/src/vaadin-grid.js';
6464
6565 grid . fcGridHelper . _heightByRowsObserver . observe ( grid ) ;
6666
67- grid . removeEventListener ( 'loading-changed' , grid . fcGridHelper . _heightByRowsListener ) ;
6867
69- grid . fcGridHelper . _heightByRowsListener = ( ) => {
70- if ( ! grid . loading ) grid . fcGridHelper . _updateHeightByRows ( n ) ;
71- } ;
68+ if ( grid . fcGridHelper . _heightByRowsMutationObserver ) {
69+ grid . fcGridHelper . _heightByRowsMutationObserver . disconnect ( ) ;
70+ }
71+
72+ grid . fcGridHelper . _heightByRowsMutationObserver = new MutationObserver ( mutationsList => {
73+ for ( const mutation of mutationsList ) {
74+ if ( mutation . type === 'childList' ) {
75+ grid . fcGridHelper . _updateHeightByRows ( n ) ;
76+ break ;
77+ } ;
78+ }
79+ } ) ;
7280
73- grid . addEventListener ( 'loading-changed' , grid . fcGridHelper . _heightByRowsListener ) ;
81+ let tbody = grid . shadowRoot . querySelector ( "tbody#items" ) ;
82+ grid . fcGridHelper . _heightByRowsMutationObserver . observe ( tbody , { childList : true } ) ;
7483 } ,
7584
7685 _updateHeightByRows : function ( n ) {
You can’t perform that action at this time.
0 commit comments