Skip to content

Commit 6fa9de8

Browse files
committed
Merge branch 'master' of https://github.com/angular-ui/ui-scroll
2 parents a0e2d0a + e848293 commit 6fa9de8

File tree

1 file changed

+11
-23
lines changed

1 file changed

+11
-23
lines changed

README.md

Lines changed: 11 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -92,38 +92,22 @@ The datasource object implements methods and properties to be used by the direct
9292

9393
* Method `get`
9494

95+
get(descriptor, success)
96+
or
97+
9598
get(index, count, success)
9699

97100
#### Description
98101
this is a mandatory method used by the directive to retrieve the data.
99102
#### Parameters
103+
* **descriptor** is an object defining the portion of the dataset requested. The object will have 3 properties. Two of them named `index` and `count`. They have the same meaning as in the alternative signature when the parameters passed explicitly (see below). The third one will be named either `append` if the items will be appended to the last item in the buffer, or `prepend` if they are to be prepended to the first item in the buffer. The value of the property in either case will be the item the new items will be appended/prepended to. This is useful if it is easier to identify the items to be added based on the previously requested items rather than on the index. Keep in mind that in certain use cases (i.e. on initial load) the value of the append/prepend property can be undefined.
100104
* **index** indicates the first data row requested
101105
* **count** indicates number of data rows requested
102-
* **success** function to call when the data are retrieved. The implementation of the service has to call this function when the data
103-
are retrieved and pass it an array of the items retrieved. If no items are retrieved, an empty array has to be passed.
106+
* **success** function to call when the data are retrieved. The implementation of the datsource has to call this function when the data are retrieved and pass it an array of the items retrieved. If no items are retrieved, an empty array has to be passed.
104107

105108
**Important:** Make sure to respect the `index` and `count` parameters of the request. The array passed to the success method should have
106109
exactly `count` elements unless it hit eof/bof
107110

108-
* Method `loading`
109-
110-
loading(value)
111-
112-
#### Description
113-
this is an optional method. If supplied this function will be called with a value indicating whether there is data loading request pending
114-
115-
**Deprecated:** Method `loading` is deprecated - use `is-loading` attribute instead
116-
117-
118-
* Method `revision`
119-
120-
revision()
121-
122-
#### Description
123-
this is an optional method. If supplied the scroller will $watch its value and will refresh the content if the value has changed
124-
125-
**Deprecated:** Method `revision` is deprecated - use `reload()` method on the adapter instead
126-
127111
###Adapter
128112
The adapter object is an internal object created for every instance of the scroller. Properties and methods of the adapter can be used to manipulate and assess the scroller the adapter was created for. Adapter based API replaces old (undocumented) event based API introduced earlier for this purpose. The event based API is now deprecated and no longer supported.
129113

@@ -139,9 +123,14 @@ Adapater object implements the following methods
139123
* Method `reload`
140124

141125
reload()
126+
or
127+
128+
reload(startIndex)
142129

143130
#### Description
144-
calling this method reinitializes and reloads the scroller content. This method is introduced as a replacement for the revision method of the datasource, which is now deprecated.
131+
Calling this method reinitializes and reloads the scroller content. `startIndex` is an integer indicating what item index the scroller will use to start the load process. Calling `reload()` is equivalent to calling `reload(1)`.
132+
133+
**important: `startIndex` should fall within underlying datset boundaries** The scroller will request two batches of items one starting from the `startIndex` and another one preceding the first one (starting from `startIndex - bufferSize`). If both requests come back empty, the scroller will consider the dataset to be empty and will place no further data requests.
145134

146135
* Method `applyUpdates`
147136

@@ -203,7 +192,6 @@ marked with uiScrollViewport directive, the browser window object will be used a
203192
</ANY>
204193
```
205194

206-
207195
###Examples
208196

209197
Examples ([look here](https://github.com/angular-ui/ui-scroll/tree/master/demo/examples)) consist of several pages (.html files) showing various ways to use the ui-scroll directive. Each page relays on its own datasource service (called `datasource`) defined in the coffescript file with the same name and .coffee extension.

0 commit comments

Comments
 (0)