sender: inst ? inst.element : null
};
},
+
propagate: function(n,e,inst, noPropagation) {
$.ui.plugin.call(this, n, [e, this.ui(inst)]);
if(!noPropagation) this.element.triggerHandler(n == "sort" ? n : "sort"+n, [e, this.ui(inst)], this.options[n]);
},
+
serialize: function(o) {
- 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
+ var items = this.getItemsAsjQuery(o && o.connected);
var str = []; o = o || {};
- items.each(function() {
- var res = ($(this).attr(o.attribute || 'id') || '').match(o.expression || (/(.+)[-=_](.+)/));
+ $(items).each(function() {
+ var res = ($(this.item || this).attr(o.attribute || 'id') || '').match(o.expression || (/(.+)[-=_](.+)/));
if(res) str.push((o.key || res[1])+'[]='+(o.key && o.expression ? res[1] : res[2]));
});
return str.join('&');
},
+
toArray: function(attr) {
- 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
+ var items = this.getItemsAsjQuery(o && o.connected);
var ret = [];
items.each(function() { ret.push($(this).attr(attr || 'id')); });
return ret;
},
+
/* Be careful with the following core functions */
intersectsWith: function(item) {
var x1 = this.positionAbs.left, x2 = x1 + this.helperProportions.width,
}
},
+
intersectsWithEdge: function(item) {
var x1 = this.positionAbs.left, x2 = x1 + this.helperProportions.width,
y1 = this.positionAbs.top, y2 = y1 + this.helperProportions.height;
return false;
},
+
refresh: function() {
this.refreshItems();
this.refreshPositions();
},
+
+ getItemsAsjQuery: function(connected) {
+
+ var self = this;
+ var items = [];
+ var queries = [];
+
+ if(this.options.connectWith && connected) {
+ for (var i = this.options.connectWith.length - 1; i >= 0; i--){
+ var cur = $(this.options.connectWith[i]);
+ for (var j = cur.length - 1; j >= 0; j--){
+ var inst = $.data(cur[j], 'sortable');
+ if(inst && inst != this && !inst.options.disabled) {
+ queries.push([$.isFunction(inst.options.items) ? inst.options.items.call(inst.element) : $(inst.options.items, inst.element).not(".ui-sortable-helper"), inst]);
+ }
+ };
+ };
+ }
+
+ queries.push([$.isFunction(this.options.items) ? this.options.items.call(this.element, null, { options: this.options, item: this.currentItem }) : $(this.options.items, this.element).not(".ui-sortable-helper"), this]);
+
+ for (var i = queries.length - 1; i >= 0; i--){
+ queries[i][0].each(function() {
+ items.push(this);
+ });
+ };
+
+ return $(items);
+
+ },
+
refreshItems: function() {
this.items = [];
var cur = $(this.options.connectWith[i]);
for (var j = cur.length - 1; j >= 0; j--){
var inst = $.data(cur[j], 'sortable');
- if(inst && !inst.options.disabled) {
+ if(inst && inst != this && !inst.options.disabled) {
queries.push([$.isFunction(inst.options.items) ? inst.options.items.call(inst.element) : $(inst.options.items, inst.element), inst]);
this.containers.push(inst);
}
};
},
+
refreshPositions: function(fast) {
//This has to be redone because due to the item being moved out/into the offsetParent, the offsetParent's position will change
}
},
+
destroy: function() {
this.element
.removeClass("ui-sortable ui-sortable-disabled")
for ( var i = this.items.length - 1; i >= 0; i-- )
this.items[i].item.removeData("sortable-item");
},
+
createPlaceholder: function(that) {
var self = that || this, o = self.options;
o.placeholder.update(self, self.placeholder);
},
+
contactContainers: function(e) {
for (var i = this.containers.length - 1; i >= 0; i--){
};
},
+
mouseCapture: function(e, overrideHandle) {
if(this.options.disabled || this.options.type == 'static') return false;
return true;
},
+
mouseStart: function(e, overrideHandle, noActivation) {
var o = this.options;
},
+
convertPositionTo: function(d, pos) {
if(!pos) pos = this.position;
var mod = d == "absolute" ? 1 : -1;
)
};
},
+
generatePosition: function(e) {
var o = this.options;
return position;
},
+
mouseDrag: function(e) {
//Compute the helpers position
return false;
},
+
rearrange: function(e, i, a, hardRefresh) {
a ? a[0].appendChild(this.placeholder[0]) : i.item[0].parentNode.insertBefore(this.placeholder[0], (this.direction == 'down' ? i.item[0] : i.item[0].nextSibling));
},0);
},
+
mouseStop: function(e, noPropagation) {
//If we are using droppables, inform the manager about the drop
return false;
},
+
clear: function(e, noPropagation) {
//We first have to update the dom position of the actual currentItem