File tree Expand file tree Collapse file tree 1 file changed +7
-6
lines changed
src/core/components/virtual-list Expand file tree Collapse file tree 1 file changed +7
-6
lines changed Original file line number Diff line number Diff line change @@ -191,17 +191,18 @@ class VirtualList extends Framework7Class {
191191 renderedItems [ parseInt ( el . getAttribute ( 'data-virtual-list-index' ) , 10 ) ] = el ;
192192 } ) ;
193193 for ( let i = 0 ; i < items . length ; i += 1 ) {
194- const renderedItem = renderedItems [ i ] ;
194+ const itemIndex = vl . items . indexOf ( items [ i ] ) ;
195+ const renderedItem = renderedItems [ itemIndex ] ;
195196 if ( renderedItem ) {
196- if ( ! vl . heightsCalculated . includes ( i ) ) {
197- vl . heights [ i ] = renderedItem . offsetHeight ;
198- vl . heightsCalculated . push ( i ) ;
197+ if ( ! vl . heightsCalculated . includes ( itemIndex ) ) {
198+ vl . heights [ itemIndex ] = renderedItem . offsetHeight ;
199+ vl . heightsCalculated . push ( itemIndex ) ;
199200 }
200201 }
201202 if ( typeof vl . heights [ i ] === 'undefined' ) {
202- vl . heights [ i ] = 40 ;
203+ vl . heights [ itemIndex ] = 40 ;
203204 }
204- vl . listHeight += vl . heights [ i ] ;
205+ vl . listHeight += vl . heights [ itemIndex ] ;
205206 }
206207 } else {
207208 vl . listHeight = Math . ceil ( items . length / vl . params . cols ) * vl . params . height ;
You can’t perform that action at this time.
0 commit comments