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 {
191
191
renderedItems [ parseInt ( el . getAttribute ( 'data-virtual-list-index' ) , 10 ) ] = el ;
192
192
} ) ;
193
193
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 ] ;
195
196
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 ) ;
199
200
}
200
201
}
201
202
if ( typeof vl . heights [ i ] === 'undefined' ) {
202
- vl . heights [ i ] = 40 ;
203
+ vl . heights [ itemIndex ] = 40 ;
203
204
}
204
- vl . listHeight += vl . heights [ i ] ;
205
+ vl . listHeight += vl . heights [ itemIndex ] ;
205
206
}
206
207
} else {
207
208
vl . listHeight = Math . ceil ( items . length / vl . params . cols ) * vl . params . height ;
You can’t perform that action at this time.
0 commit comments