You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+11-23Lines changed: 11 additions & 23 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -92,38 +92,22 @@ The datasource object implements methods and properties to be used by the direct
92
92
93
93
* Method `get`
94
94
95
+
get(descriptor, success)
96
+
or
97
+
95
98
get(index, count, success)
96
99
97
100
#### Description
98
101
this is a mandatory method used by the directive to retrieve the data.
99
102
#### 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.
100
104
* **index** indicates the first data row requested
101
105
* **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.
104
107
105
108
**Important:** Make sure to respect the `index` and `count` parameters of the request. The array passed to the success method should have
106
109
exactly `count` elements unless it hit eof/bof
107
110
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
-
127
111
###Adapter
128
112
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.
129
113
@@ -139,9 +123,14 @@ Adapater object implements the following methods
139
123
* Method `reload`
140
124
141
125
reload()
126
+
or
127
+
128
+
reload(startIndex)
142
129
143
130
#### 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.
145
134
146
135
* Method `applyUpdates`
147
136
@@ -203,7 +192,6 @@ marked with uiScrollViewport directive, the browser window object will be used a
203
192
</ANY>
204
193
```
205
194
206
-
207
195
###Examples
208
196
209
197
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