Skip to content

Commit 54b7658

Browse files
committed
reload takes a parameter - starting index
1 parent 1bbc5d8 commit 54b7658

File tree

1 file changed

+11
-7
lines changed

1 file changed

+11
-7
lines changed

src/ui-scroll.coffee

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -73,9 +73,7 @@ angular.module('ui.scroll', [])
7373

7474
buffer = Object.create Array.prototype
7575

76-
origin = 1 # starting index for initial load
77-
78-
reset = ->
76+
reset = (origin)->
7977
buffer.eof = false
8078
buffer.bof = false
8179
buffer.first = origin
@@ -145,9 +143,12 @@ angular.module('ui.scroll', [])
145143
# clears the buffer
146144
buffer.clear = ->
147145
buffer.remove(0, buffer.length)
148-
reset()
146+
if arguments.length
147+
reset arguments[0]
148+
else
149+
reset(1)
149150

150-
reset()
151+
reset(1)
151152

152153
buffer
153154

@@ -400,7 +401,10 @@ angular.module('ui.scroll', [])
400401

401402
reload = ->
402403
dismissPendingRequests()
403-
buffer.clear()
404+
if arguments.length
405+
buffer.clear arguments[0]
406+
else
407+
buffer.clear()
404408
adjustBuffer ridActual
405409

406410
adapter.reload = reload
@@ -551,7 +555,7 @@ angular.module('ui.scroll', [])
551555
viewport.bind 'scroll', resizeAndScrollHandler
552556
viewport.bind 'mousewheel', wheelHandler
553557

554-
$scope.$watch datasource.revision, reload
558+
$scope.$watch datasource.revision, -> reload()
555559

556560
$scope.$on '$destroy', ->
557561
# clear the buffer. It is necessary to remove the elements and $destroy the scopes

0 commit comments

Comments
 (0)