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
{{ message }}
This repository was archived by the owner on Jan 24, 2019. It is now read-only.
Copy file name to clipboardExpand all lines: modules/scroll/README.md
+50-4Lines changed: 50 additions & 4 deletions
Original file line number
Diff line number
Diff line change
@@ -71,10 +71,14 @@ dl as a repeated tag is not supported.
71
71
***buffer-size - value**, optional - number of items requested from the datasource in a single request. The default is 10 and the minimal value is 3
72
72
***padding - value**, optional - extra height added to the visible area for the purpose of determining when the items should be created/destroyed.
73
73
The value is relative to the visible height of the area, the default is 0.5 and the minimal value is 0.3
74
-
***is-loading - name**, optional - if provided a boolean value indicating whether there are any pending load requests will be placed in the member with the said name on the scope associated with the viewport. If the viewport is the window, the value will be placed on the $rootScope
75
-
***top-visible - name**, optional - if provided a reference to the item currently in the topmost visible position will be placed in the member with the said name on the scope associated with the viewport. If the viewport is the window, the value will be placed on the $rootScope
76
-
***top-visible-element - name**, optional - if provided a reference to the DOM element currently in the topmost visible position will be placed in the member with the said name on the scope associated with the viewport. If the viewport is the window, the value will be placed on the $rootScope
77
-
***top-visible-scope - name**, optional - if provided a reference to the scope created for the item currently in the topmost visible position will be placed in the member with the said name on the scope associated with the viewport. If the viewport is the window, the value will be placed on the $rootScope
74
+
***adapter - name**, optional - if provided a reference to the adapter object for the scroller instance will be placed in the member with the said name on the scope associated with the viewport. If the viewport is the window, the value will be placed on the $rootScope. The adapter is a collection of methods and properties to manipulate and assess the scroller the adapter was created for.
75
+
76
+
Some of the properties offered by the adapter can also be accessed directly from the directive by using matching attributes. In the same way as for the adapter attribute syntax for such attributes allows for providing a name under which the appropariate value will be placed on the scope associated with the viewport. If the viewport is the window, the value will be placed on the $rootScope. Below is a list of such attributes:
77
+
78
+
***is-loading - name**, optional - a boolean value indicating whether there are any pending load requests will be placed in the member with the said name. See also `isLoading` adapter property.
79
+
***top-visible - name**, optional - a reference to the item currently in the topmost visible position will be placed in the member with the said name. See also `topVisible` adapter property.
80
+
***top-visible-element - name**, optional - a reference to the DOM element currently in the topmost visible position will be placed in the member with the said name. See also `topVisibleElement` adapter property.
81
+
***top-visible-scope - name**, optional - a reference to the scope created for the item currently in the topmost visible position will be placed in the member with the said name. See also `topVisibleScope` adapter property.
78
82
79
83
###Data Source
80
84
Data source is an object to be used by the uiScroll directive to access the data.
@@ -116,6 +120,36 @@ exactly `count` elements unless it hit eof/bof
116
120
#### Description
117
121
this is an optional method. If supplied the scroller will $watch its value and will refresh the content if the value has changed
118
122
123
+
###Adapter
124
+
Adapter object is a collection of methods and properties to be used to assess and manipulate the scroller instance adapater is created for. Adapter based API replaces old (undocumented) event based API introduced earlier for this purpose. The event based API is now deprecated but will remain available for backwards compatibililty purposes.
125
+
126
+
####Manipulating the scroller content with applyUpdates method
127
+
128
+
Method `applyUpdates` provides a way to update the scroller content without full reload of the content from the datasource. The updates are performed by changing the items in the scroller internal buffer after they are loaded from the datasource. An item in the buffer can be deleted or modified. Also several items can be inserted to replace a given item.
129
+
130
+
* Method `applyUpdates(index, newItems)`
131
+
132
+
#### Description
133
+
Updates scroller content at the given location in the dataset
134
+
#### Parameters
135
+
* **index** index of the item to be affected in the dataset.
136
+
* **newItems** an array of items to replace the affected item. If the array is empty (`[]`) the item will be deleted, otherwise the items in the array replace the affected item.
137
+
138
+
* Method `applyUpdates(updater)`
139
+
140
+
#### Description
141
+
Updates scroller content as determined by the updater function
142
+
#### Parameters
143
+
* **updater** a function to be applied to every item currently in the buffer. The function will recieve 3 parameters: `item`, `scope`, and `element`. Here `item` is the item to be affected, `scope` is the item $scope, and `element` is the html element for the item. The return value of the function should be an array of items. Similarly to the `newItem` parameter (see above), if the array is empty(`[]`), the item is deleted, otherwise the item is replaced by the items in the array. If the return value is not an array, the item remains unaffected, unless some updates were made to the item in the updater function. This can be thought of as in place update.
144
+
145
+
**Important:** Keep in mind that the modifications made by the `applyUpdates` methods are only applied to the content of the buffer. As the items in response to scrolling are pushed out of the buffer, the modifications are lost. It is your responsibility to ensure that as the scroller is scrolled back and a modified item is requested from the datasource again the values returned by the datasource would reflect the updated state. In other words you have to make sure that in addition to manipulating the scroller content you also apply the modifications to the dataset underlying the datasource.
146
+
147
+
####Adapter properties
148
+
149
+
*`isLoading` - a boolean value indicating whether there are any pending load requests.
150
+
*`topVisible` - a reference to the item currently in the topmost visible position.
151
+
*`topVisibleElement` - a reference to the DOM element currently in the topmost visible position.
152
+
*`topVisibleScope` - a reference to the scope created for the item currently in the topmost visible position.
119
153
120
154
uiScrollViewport directive
121
155
-------------------
@@ -154,6 +188,18 @@ Do not ask me why this woodoo is necessary, but as of Chrome version 30 it is ju
154
188
155
189
###History
156
190
191
+
####v1.1.0
192
+
* Introduced API to dynamically update scroller content.
193
+
* Deep 'name' properties access via dot-notation in template.
194
+
* Fixed the problem occuring if the scroller is $destroyed while there are requests pending: [#64](https://github.com/Hill30/NGScroller/issues/64).
195
+
196
+
####v1.0.3
197
+
* Fixed memory leak on scroller destroy: [#63](https://github.com/Hill30/NGScroller/issues/63).
198
+
* Removed examples from bower download list.
199
+
200
+
####v1.0.2
201
+
* Registration of ui-scroll in bower.
202
+
157
203
####v1.0.1
158
204
* Deep datasource access via dot-notation in template.
159
205
*[Angular 1.3.x breaking change](https://github.com/angular/angular.js/issues/8876) fix with backward compatibility.
0 commit comments