@@ -82,7 +82,7 @@ angular.module('ui.scroll', [])
82
82
let pending = [ ] ;
83
83
84
84
const elementRoutines = new ElementRoutines ( $injector , $q ) ;
85
- const buffer = new ScrollBuffer ( elementRoutines , bufferSize ) ;
85
+ const buffer = new ScrollBuffer ( elementRoutines , bufferSize , startIndex ) ;
86
86
const viewport = new Viewport ( elementRoutines , buffer , element , viewportController , $rootScope , padding ) ;
87
87
const adapter = new Adapter ( $scope , $parse , $attr , viewport , buffer , doAdjust , reload ) ;
88
88
@@ -106,12 +106,11 @@ angular.module('ui.scroll', [])
106
106
onRenderHandlers . forEach ( handler => handler ( ) ) ;
107
107
onRenderHandlers = [ ] ;
108
108
}
109
- function persistDatasourceIndex ( datasource , propName , doNotDelete ) {
109
+ function persistDatasourceIndex ( datasource , propName ) {
110
110
let getter ;
111
111
// need to postpone min/maxIndexUser processing if the view is empty
112
112
if ( datasource . hasOwnProperty ( propName ) && ! buffer . length ) {
113
113
getter = datasource [ propName ] ;
114
- delete datasource [ propName ] ;
115
114
onRenderHandlers . push ( ( ) => datasource [ propName ] = getter ) ;
116
115
}
117
116
}
@@ -167,7 +166,7 @@ angular.module('ui.scroll', [])
167
166
tryCount ++ ;
168
167
if ( viewport . applyContainerStyle ( ) ) {
169
168
$interval . cancel ( timer ) ;
170
- reload ( ) ;
169
+ doAdjust ( ) ;
171
170
}
172
171
if ( tryCount * VIEWPORT_POLLING_INTERVAL >= MAX_VIEWPORT_DELAY ) {
173
172
$interval . cancel ( timer ) ;
@@ -176,7 +175,7 @@ angular.module('ui.scroll', [])
176
175
} , VIEWPORT_POLLING_INTERVAL ) ;
177
176
}
178
177
else {
179
- reload ( ) ;
178
+ doAdjust ( ) ;
180
179
}
181
180
} ;
182
181
@@ -228,6 +227,8 @@ angular.module('ui.scroll', [])
228
227
startIndex = arguments [ 0 ] ;
229
228
}
230
229
buffer . reset ( startIndex ) ;
230
+ persistDatasourceIndex ( datasource , 'minIndex' ) ;
231
+ persistDatasourceIndex ( datasource , 'maxIndex' ) ;
231
232
doAdjust ( ) ;
232
233
}
233
234
0 commit comments