Skip to content

Commit 692610c

Browse files
committed
added destroy method
1 parent 8ad5665 commit 692610c

File tree

1 file changed

+13
-3
lines changed

1 file changed

+13
-3
lines changed

source/js/jquery-sortable.js

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -200,12 +200,13 @@
200200
function ContainerGroup(options) {
201201
this.options = $.extend({}, groupDefaults, options)
202202
this.containers = []
203-
this.scrollProxy = $.proxy(this.scroll, this)
204-
this.dragProxy = $.proxy(this.drag, this)
205-
this.dropProxy = $.proxy(this.drop, this)
206203

207204
if(!this.options.parentContainer){
205+
this.scrollProxy = $.proxy(this.scroll, this)
206+
this.dragProxy = $.proxy(this.drag, this)
207+
this.dropProxy = $.proxy(this.drop, this)
208208
this.placeholder = $(this.options.placeholder)
209+
209210
if(!options.isValidTarget)
210211
this.options.isValidTarget = undefined
211212
}
@@ -400,6 +401,11 @@
400401
while(i--){
401402
this.containers[i].clearDimensions()
402403
}
404+
},
405+
destroy: function () {
406+
// TODO iterate over subgroups and destroy them
407+
// TODO remove all events
408+
containerGroups[this.options.group] = undefined
403409
}
404410
}
405411

@@ -519,6 +525,7 @@
519525
if(childContainers[0]){
520526
var options = $.extend({}, this.options, {
521527
parentContainer: this,
528+
rootGroup: this.rootGroup,
522529
group: groupCounter ++
523530
})
524531
childGroup = childContainers[pluginName](options).data(pluginName).group
@@ -573,6 +580,9 @@
573580
},
574581
serialize: function () {
575582
return this._serialize(this.el, true)
583+
},
584+
destroy: function () {
585+
this.rootGroup.destroy()
576586
}
577587
}
578588

0 commit comments

Comments
 (0)