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

Commit 837f1a6

Browse files
committed
docs(API.md): add API.md explaining ui.item.sortable properties
1 parent 06b506e commit 837f1a6

File tree

2 files changed

+59
-1
lines changed

2 files changed

+59
-1
lines changed

API.md

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
# ui.item.sortable API documentation
2+
3+
## Properties
4+
5+
### dropindex
6+
Type: [Integer](http://api.jquery.com/Types/#Integer)
7+
Holds the index of the drop target that the dragged item was dropped.
8+
9+
10+
### droptarget
11+
Type: [jQuery](http://api.jquery.com/Types/#jQuery)
12+
Holds the ui-sortable element that the dragged item was dropped on.
13+
14+
### droptargetModel
15+
Type: [Array](http://api.jquery.com/Types/#Array)
16+
Holds the array that is specified by the `ng-model` attribute of the [`droptarget`](#droptarget) ui-sortable element.
17+
18+
### index
19+
Type: [Integer](http://api.jquery.com/Types/#Integer)
20+
Holds the original index of the item dragged.
21+
22+
### model
23+
Type: [Object](http://api.jquery.com/Types/#Object)
24+
Holds the JavaScript object that is used as the model of the dragged item, as specified by the ng-repeat of the [`source`](#source) ui-sortable element and the item's [`index`](#index).
25+
26+
### moved
27+
Type: [Object](http://api.jquery.com/Types/#Object)/`undefined`
28+
Holds the model of the dragged item only when a sorting happens between two connected ui-sortable elements.
29+
In other words: `'moved' in ui.item.sortable` will return false only when a sorting is withing the same ui-sortable element ([`source`](#source) equals to the [`droptarget`](#droptarget)).
30+
31+
### received
32+
Type: [Boolean](http://api.jquery.com/Types/#Boolean)
33+
When sorting between two connected sortables, it will be set to true inside the `update` callback of the [`droptarget`](#droptarget).
34+
35+
### source
36+
Type: [jQuery](http://api.jquery.com/Types/#jQuery)
37+
Holds the ui-sortable element that the dragged item originated from.
38+
39+
### sourceModel
40+
Type: [Array](http://api.jquery.com/Types/#Array)
41+
Holds the array that is specified by the `ng-model` of the [`source`](#source) ui-sortable element.
42+
43+
44+
## Methods
45+
46+
### cancel[()](http://api.jquery.com/Types/#Function)
47+
Returns: Nothing
48+
Can be called inside the `update` callback, in order to prevent/revert a sorting.
49+
Should be used instead of the [jquery-ui-sortable cancel()](http://api.jqueryui.com/sortable/#method-cancel) method.
50+
51+
### isCanceled[()](http://api.jquery.com/Types/#Function)
52+
Returns: [Boolean](http://api.jquery.com/Types/#Boolean)
53+
Returns whether the current sorting is marked as canceled, by an earlier call to [`ui.item.sortable.cancel()`](#cancel).
54+
55+
### isCustomHelperUsed[()](http://api.jquery.com/Types/#Function)
56+
Returns: [Boolean](http://api.jquery.com/Types/#Boolean)
57+
Returns whether the [`helper`](http://api.jqueryui.com/sortable/#option-helper) element used for the current sorting, is one of the original ui-sortable list elements.

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,8 @@ Apply the directive to your form elements:
4646

4747
### Options
4848

49-
All the [jQueryUI Sortable options](http://api.jqueryui.com/sortable/) can be passed through the directive.
49+
All the [jQueryUI Sortable options](http://api.jqueryui.com/sortable/) can be passed through the directive.
50+
Additionally, the `ui` argument of the available callbacks gets enriched with some extra properties as specified to the [API.md file](API.md#uiitemsortable-api-documentation).
5051

5152

5253
```js

0 commit comments

Comments
 (0)