Skip to content

Commit f1f5973

Browse files
Jonas von AndrianJonas von Andrian
authored andcommitted
Update examples to pass along the container parameter
1 parent ee92292 commit f1f5973

File tree

6 files changed

+32
-32
lines changed

6 files changed

+32
-32
lines changed

source/js/examples/limited_drop_targets.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
11
$(function () {
22
var group = $("ol.limited_drop_targets").sortable({
33
group: 'limited_drop_targets',
4-
isValidTarget: function (item, container) {
5-
if(item.is(".highlight"))
4+
isValidTarget: function ($item, container) {
5+
if($item.is(".highlight"))
66
return true
77
else {
8-
return item.parent("ol")[0] == container.el[0]
8+
return $item.parent("ol")[0] == container.el[0]
99
}
1010
},
11-
onDrop: function (item, container, _super) {
11+
onDrop: function ($item, container, _super) {
1212
$('#serialize_output').text(group.sortable("serialize").get().join("\n"))
13-
_super(item, container)
13+
_super($item, container)
1414
},
1515
serialize: function (parent, children, isContainer) {
1616
return isContainer ? children.join() : parent.text()

source/js/examples/nested_with_switch.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,16 +7,16 @@ $(function () {
77
if(oldContainer)
88
oldContainer.el.removeClass("active")
99
container.el.addClass("active")
10-
10+
1111
oldContainer = container
1212
}
1313
},
14-
onDrop: function (item, container, _super) {
14+
onDrop: function ($item, container, _super) {
1515
container.el.removeClass("active")
16-
_super(item)
16+
_super($item, container)
1717
}
1818
})
19-
19+
2020
$(".switch-container").on("click", ".switch", function (e) {
2121
var method = $(this).hasClass("active") ? "enable" : "disable"
2222
$(e.delegateTarget).next().sortable(method)

source/js/examples/serialization.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,13 @@ $(function () {
22
var group = $("ol.serialization").sortable({
33
group: 'serialization',
44
delay: 500,
5-
onDrop: function (item, container, _super) {
5+
onDrop: function ($item, container, _super) {
66
var data = group.sortable("serialize").get();
77

88
var jsonString = JSON.stringify(data, null, ' ');
99

1010
$('#serialize_output2').text(jsonString);
11-
_super(item, container)
11+
_super($item, container)
1212
}
1313
})
1414
})

source/js/examples/simple_with_animation.js

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,18 +5,18 @@ $(function () {
55
group: 'simple_with_animation',
66
pullPlaceholder: false,
77
// animation on drop
8-
onDrop: function (item, targetContainer, _super) {
9-
var clonedItem = $('<li/>').css({height: 0})
10-
item.before(clonedItem)
11-
clonedItem.animate({'height': item.height()})
12-
13-
item.animate(clonedItem.position(), function () {
14-
clonedItem.detach()
15-
_super(item)
8+
onDrop: function ($item, container, _super) {
9+
var $clonedItem = $('<li/>').css({height: 0})
10+
$item.before($clonedItem)
11+
$clonedItem.animate({'height': $item.height()})
12+
13+
$item.animate($clonedItem.position(), function () {
14+
$clonedItem.detach()
15+
_super($item, container)
1616
})
1717
},
1818

19-
// set item relative to cursor position
19+
// set $item relative to cursor position
2020
onDragStart: function ($item, container, _super) {
2121
var offset = $item.offset(),
2222
pointer = container.rootGroup.pointer

source/js/examples/simple_with_no_drop.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@ $(function() {
22
$("ol.simple_with_drop").sortable({
33
group: 'no-drop',
44
handle: 'i.icon-move',
5-
onDragStart: function (item, container, _super) {
5+
onDragStart: function ($item, container, _super) {
66
// Duplicate items of the no drop area
77
if(!container.options.drop)
8-
item.clone().insertAfter(item)
9-
_super(item)
8+
$item.clone().insertAfter($item)
9+
_super($item, container)
1010
}
1111
})
1212
$("ol.simple_with_no_drop").sortable({

source/js/examples/table.js

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -14,17 +14,17 @@ $(function () {
1414
itemSelector: 'th',
1515
placeholder: '<th class="placeholder"/>',
1616
vertical: false,
17-
onDragStart: function (item, group, _super) {
18-
oldIndex = item.index()
19-
item.appendTo(item.parent())
20-
_super(item)
17+
onDragStart: function ($item, container, _super) {
18+
oldIndex = $item.index()
19+
$item.appendTo($item.parent())
20+
_super($item, container)
2121
},
22-
onDrop: function (item, container, _super) {
22+
onDrop: function ($item, container, _super) {
2323
var field,
24-
newIndex = item.index()
25-
24+
newIndex = $item.index()
25+
2626
if(newIndex != oldIndex)
27-
item.closest('table').find('tbody tr').each(function (i, row) {
27+
$item.closest('table').find('tbody tr').each(function (i, row) {
2828
row = $(row)
2929
field = row.children().eq(oldIndex)
3030
if(newIndex)
@@ -33,7 +33,7 @@ $(function () {
3333
row.prepend(field)
3434
})
3535

36-
_super(item)
36+
_super($item, container)
3737
}
3838
})
3939
})

0 commit comments

Comments
 (0)