Browse Source

* group.put — can be an array

pull/126/merge
RubaXa 10 years ago
parent
commit
8a4bff0ac6
  1. 12
      README.md
  2. 8
      Sortable.js
  3. 2
      Sortable.min.js
  4. 2
      index.html

12
README.md

@ -32,7 +32,7 @@ Sortable.create(el);
### Options
```js
var sortabel = new Sortable(el, {
group: "name", // or { name: "..", pull: [true, false, clone], put: true }
group: "name", // or { name: "..", pull: [true, false, clone], put: [true, false, array] }
sort: true, // sorting inside list
store: null, // @see Store
animation: 150, // ms, animation speed moving items when sorting, `0` — without animation
@ -65,6 +65,16 @@ var sortabel = new Sortable(el, {
---
### `group` option
* name:`string` — group name
* pull:`true|false|'clone'` — ability to move from the list. `clone` — cloning drag item when moving from the list.
* put:`true|false|["foo", "bar"]` — the possibility of adding an element from the other list, or an array of names groups, which can be taken.
---
### Method
##### closest(el:`String`[, selector:`HTMLElement`]):`HTMLElement|null`

8
Sortable.js

@ -99,6 +99,7 @@
options.group = { name: options.group };
}
['pull', 'put'].forEach(function (key) {
if (!(key in options.group)) {
options.group[key] = true;
@ -356,11 +357,12 @@
revert,
options = this.options,
group = options.group,
groupPut = group.put,
isOwner = (activeGroup === group);
if( !_silent &&
(activeGroup.name === group.name) &&
(isOwner && (options.sort || (revert = !rootEl.contains(dragEl))) || group.put && activeGroup.pull) &&
(activeGroup.name === group.name || groupPut && groupPut.indexOf && groupPut.indexOf(activeGroup.name) > -1) &&
(isOwner && (options.sort || (revert = !rootEl.contains(dragEl))) || groupPut && activeGroup.pull) &&
(evt.rootEl === void 0 || evt.rootEl === this.el)
){
target = _closest(evt.target, this.options.draggable, el);
@ -492,6 +494,8 @@
_dispatchEvent(dragEl, 'end');
}
cloneEl.parentNode.removeChild(cloneEl);
// Set NULL
rootEl =
dragEl =

2
Sortable.min.js vendored

File diff suppressed because one or more lines are too long

2
index.html

@ -297,7 +297,7 @@ var editableList = new Sortable(editable, {
pull: false,
put: true
}].forEach(function (opts, i) {
new Sortable(document.getElementById(opts.name + '-' + (i + 1)), {
new Sortable(document.getElementById('advanced-' + (i + 1)), {
group: opts,
animation: 150
});

Loading…
Cancel
Save