@@ -82,7 +82,7 @@ angular.module('ui.scroll', [])
8282 let pending = [ ] ;
8383
8484 const elementRoutines = new ElementRoutines ( $injector , $q ) ;
85- const buffer = new ScrollBuffer ( elementRoutines , bufferSize ) ;
85+ const buffer = new ScrollBuffer ( elementRoutines , bufferSize , startIndex ) ;
8686 const viewport = new Viewport ( elementRoutines , buffer , element , viewportController , $rootScope , padding ) ;
8787 const adapter = new Adapter ( $scope , $parse , $attr , viewport , buffer , doAdjust , reload ) ;
8888
@@ -106,12 +106,11 @@ angular.module('ui.scroll', [])
106106 onRenderHandlers . forEach ( handler => handler ( ) ) ;
107107 onRenderHandlers = [ ] ;
108108 }
109- function persistDatasourceIndex ( datasource , propName , doNotDelete ) {
109+ function persistDatasourceIndex ( datasource , propName ) {
110110 let getter ;
111111 // need to postpone min/maxIndexUser processing if the view is empty
112112 if ( datasource . hasOwnProperty ( propName ) && ! buffer . length ) {
113113 getter = datasource [ propName ] ;
114- delete datasource [ propName ] ;
115114 onRenderHandlers . push ( ( ) => datasource [ propName ] = getter ) ;
116115 }
117116 }
@@ -167,7 +166,7 @@ angular.module('ui.scroll', [])
167166 tryCount ++ ;
168167 if ( viewport . applyContainerStyle ( ) ) {
169168 $interval . cancel ( timer ) ;
170- reload ( ) ;
169+ doAdjust ( ) ;
171170 }
172171 if ( tryCount * VIEWPORT_POLLING_INTERVAL >= MAX_VIEWPORT_DELAY ) {
173172 $interval . cancel ( timer ) ;
@@ -176,7 +175,7 @@ angular.module('ui.scroll', [])
176175 } , VIEWPORT_POLLING_INTERVAL ) ;
177176 }
178177 else {
179- reload ( ) ;
178+ doAdjust ( ) ;
180179 }
181180 } ;
182181
@@ -228,6 +227,8 @@ angular.module('ui.scroll', [])
228227 startIndex = arguments [ 0 ] ;
229228 }
230229 buffer . reset ( startIndex ) ;
230+ persistDatasourceIndex ( datasource , 'minIndex' ) ;
231+ persistDatasourceIndex ( datasource , 'maxIndex' ) ;
231232 doAdjust ( ) ;
232233 }
233234
0 commit comments