Skip to content
This repository was archived by the owner on Sep 8, 2020. It is now read-only.

Commit 7ebaa33

Browse files
committed
docs(README): improve docs for attr callbacks
1 parent b506cb0 commit 7ebaa33

File tree

1 file changed

+31
-30
lines changed

1 file changed

+31
-30
lines changed

README.md

Lines changed: 31 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -104,18 +104,41 @@ To provide a solution/workaround (till jquery.ui.sortable.refresh() also tests t
104104
</ul>
105105
```
106106

107+
**OR**
108+
109+
```js
110+
$scope.sortableOptions = {
111+
'ui-floating': true
112+
};
113+
```
114+
```html
115+
<ul ui-sortable="sortableOptions" ng-model="items">
116+
<li ng-repeat="item in items">{{ item }}</li>
117+
</ul>
118+
```
119+
120+
121+
**ui-floating** (default: undefined)
122+
Type: [Boolean](http://api.jquery.com/Types/#Boolean)/[String](http://api.jquery.com/Types/#String)/`undefined`
123+
* **undefined**: Relies on jquery.ui to detect the list's orientation.
124+
* **false**: Forces jquery.ui.sortable to detect the list as vertical.
125+
* **true**: Forces jquery.ui.sortable to detect the list as horizontal.
126+
* **"auto"**: Detects on each drag `start` if the element is floating or not.
107127

108128
#### Attributes For Event Handling
109129

110130
To handle events with html bindings just define any expression to listed event attributes.
111-
If you defined an attribute for this events and defined callback function in sortableOptions at the same time attribute based callback will be selected.
112-
If attribute based callback expression is not filled then sortableOption based callback function will be selected.
131+
If you defined an attribute for this events and defined callback function in sortableOptions at the same time, the attribute based callback will be called first.
113132

114-
* **ui-sortable-receive**
115-
* **ui-sortable-remove**
133+
* **ui-sortable-activate**
116134
* **ui-sortable-start**
117-
* **ui-sortable-stop**
135+
* **ui-sortable-activate**
136+
* **ui-sortable-before-stop**
118137
* **ui-sortable-update**
138+
* **ui-sortable-remove**
139+
* **ui-sortable-receive**
140+
* **ui-sortable-deactivate**
141+
* **ui-sortable-stop**
119142

120143

121144

@@ -127,40 +150,18 @@ Expression works on update event.
127150
```
128151

129152

130-
callBackFunction2 works on update event.
131-
```js
132-
$scope.sortableOptions = {
133-
'update': callBackFunction
134-
};
135-
```
136-
```html
137-
<ul ui-sortable="sortableOptions" ng-model="items" ui-sortable-update="callBackFunction2()" >
138-
<li ng-repeat="item in items">{{ item }}</li>
139-
</ul>
140-
```
141-
142-
143-
**OR**
144-
153+
On update event callBackFunction1 if called before callBackFunction2.
145154
```js
146155
$scope.sortableOptions = {
147-
'ui-floating': true
156+
'update': callBackFunction2
148157
};
149158
```
150159
```html
151-
<ul ui-sortable="sortableOptions" ng-model="items">
160+
<ul ui-sortable="sortableOptions" ng-model="items" ui-sortable-update="callBackFunction1()" >
152161
<li ng-repeat="item in items">{{ item }}</li>
153162
</ul>
154163
```
155164

156-
157-
**ui-floating** (default: undefined)
158-
Type: [Boolean](http://api.jquery.com/Types/#Boolean)/[String](http://api.jquery.com/Types/#String)/`undefined`
159-
* **undefined**: Relies on jquery.ui to detect the list's orientation.
160-
* **false**: Forces jquery.ui.sortable to detect the list as vertical.
161-
* **true**: Forces jquery.ui.sortable to detect the list as horizontal.
162-
* **"auto"**: Detects on each drag `start` if the element is floating or not.
163-
164165
#### Canceling
165166

166167
Inside the `update` callback, you can check the item that is dragged and cancel the sorting.

0 commit comments

Comments
 (0)