this.instance.cancelHelperRemoval = false; //Remove it in the sortable instance (so sortable plugins like revert still work)\r
if(this.shouldRevert) this.instance.options.revert = true; //revert here\r
this.instance.mouseStop(e);\r
+ \r
+ //Also propagate receive event, since the sortable is actually receiving a element\r
+ this.instance.element.triggerHandler("sortreceive", [e, $.extend(this.instance.ui(), { sender: inst.element })], this.instance.options["receive"]);\r
+\r
this.instance.options.helper = "original";\r
}\r
});\r
this.instance.isOver = 0;\r
this.instance.cancelHelperRemoval = true;\r
this.instance.options.revert = false; //No revert here\r
- this.instance.mouseStop(e);\r
+ this.instance.mouseStop(e, true);\r
this.instance.options.helper = "original";\r
\r
//Now we remove our currentItem, the list group clone again, and the placeholder, and animate the helper back to it's original size\r
sender: inst ? inst.element : null\r
}; \r
},\r
- propagate: function(n,e,inst) {\r
+ propagate: function(n,e,inst, noPropagation) {\r
$.ui.plugin.call(this, n, [e, this.ui(inst)]);\r
- this.element.triggerHandler(n == "sort" ? n : "sort"+n, [e, this.ui(inst)], this.options[n]);\r
+ if(!noPropagation) this.element.triggerHandler(n == "sort" ? n : "sort"+n, [e, this.ui(inst)], this.options[n]);\r
},\r
serialize: function(o) {\r
\r
- var items = $(this.options.items, this.element).not('.ui-sortable-helper'); //Only the items of the sortable itself\r
+ \r
+ \r
+ var items = ($.isFunction(this.options.items) ? this.options.items.call(this.element) : $(this.options.items, this.element)).not('.ui-sortable-helper'); //Only the items of the sortable itself\r
var str = []; o = o || {};\r
\r
items.each(function() {\r
\r
},\r
toArray: function(attr) {\r
- var items = $(this.options.items, this.element).not('.ui-sortable-helper'); //Only the items of the sortable itself\r
+ var items = ($.isFunction(this.options.items) ? this.options.items.call(this.element) : $(this.options.items, this.element)).not('.ui-sortable-helper'); //Only the items of the sortable itself\r
var ret = [];\r
\r
items.each(function() { ret.push($(this).attr(attr || 'id')); });\r
for (var j = cur.length - 1; j >= 0; j--){\r
var inst = $.data(cur[j], 'sortable');\r
if(inst && !inst.options.disabled) {\r
- queries.push($.isFunction(inst.options.items) ? inst.options.items.call(this.element) : $(inst.options.items, inst.element));\r
+ queries.push($.isFunction(inst.options.items) ? inst.options.items.call(inst.element) : $(inst.options.items, inst.element));\r
this.containers.push(inst);\r
}\r
};\r
return false;\r
\r
},\r
- mouseStop: function(e) {\r
+ mouseStop: function(e, noPropagation) {\r
\r
//If we are using droppables, inform the manager about the drop\r
if ($.ui.ddmanager && !this.options.dropBehaviour)\r
left: cur.left - this.offset.parent.left - self.margins.left + (this.offsetParent[0] == document.body ? 0 : this.offsetParent[0].scrollLeft),\r
top: cur.top - this.offset.parent.top - self.margins.top + (this.offsetParent[0] == document.body ? 0 : this.offsetParent[0].scrollTop)\r
}, parseInt(this.options.revert, 10) || 500, function() {\r
- self.propagate("stop", e);\r
+ self.propagate("stop", e, null, noPropagation);\r
self.clear(e);\r
});\r
} else {\r
- this.propagate("stop", e);\r
- this.clear(e);\r
+ this.propagate("stop", e, null, noPropagation);\r
+ this.clear(e, noPropagation);\r
}\r
\r
return false;\r
\r
},\r
- clear: function(e) {\r
+ clear: function(e, noPropagation) {\r
\r
- if(this.domPosition != this.currentItem.prev()[0]) this.propagate("update", e); //Trigger update callback if the DOM position has changed\r
+ if(this.domPosition != this.currentItem.prev()[0]) this.propagate("update", e, null, noPropagation); //Trigger update callback if the DOM position has changed\r
if(!contains(this.element[0], this.currentItem[0])) { //Node was moved out of the current element\r
this.propagate("remove", e);\r
for (var i = this.containers.length - 1; i >= 0; i--){\r