Skip to content
Permalink
Browse files

sortable: removed ui.element and ui.options from the UI object, corre…

…cted the callback for the items option, now includes event if applicable
  • Loading branch information...
Paul Bakaus
Paul Bakaus committed Nov 19, 2008
1 parent 8306e62 commit 2a6a3561092a3c34d3f5c6b759e4af3ec01fcf0f
Showing with 6 additions and 8 deletions.
  1. +6 −8 ui/ui.sortable.js
@@ -40,8 +40,6 @@ $.widget("ui.sortable", $.extend({}, $.ui.mouse, {
placeholder: self.placeholder || $([]),
position: self.position,
absolutePosition: self.positionAbs,
options: this.options,
element: this.element,
item: self.currentItem,
sender: inst ? inst.element : null
};
@@ -206,8 +204,8 @@ $.widget("ui.sortable", $.extend({}, $.ui.mouse, {
return direction;
},

refresh: function() {
this._refreshItems();
refresh: function(event) {
this._refreshItems(event);
this.refreshPositions();
},

@@ -256,21 +254,21 @@ $.widget("ui.sortable", $.extend({}, $.ui.mouse, {

},

_refreshItems: function() {
_refreshItems: function(event) {

this.items = [];
this.containers = [this];
var items = this.items;
var self = this;
var queries = [[$.isFunction(this.options.items) ? this.options.items.call(this.element, null, { options: this.options, item: this.currentItem }) : $(this.options.items, this.element), this]];
var queries = [[$.isFunction(this.options.items) ? this.options.items.call(this.element[0], event, { item: this.currentItem }) : $(this.options.items, this.element), this]];

if(this.options.connectWith) {
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), inst]);
queries.push([$.isFunction(inst.options.items) ? inst.options.items.call(inst.element[0], event, { item: this.currentItem }) : $(inst.options.items, inst.element), inst]);
this.containers.push(inst);
}
};
@@ -449,7 +447,7 @@ $.widget("ui.sortable", $.extend({}, $.ui.mouse, {
if(this.options.disabled || this.options.type == 'static') return false;

//We have to refresh the items data once first
this._refreshItems();
this._refreshItems(event);

//Find out if the clicked node (or one of its parents) is a actual item in this.items
var currentItem = null, self = this, nodes = $(event.target).parents().each(function() {

0 comments on commit 2a6a356

Please sign in to comment.
You can’t perform that action at this time.