Ox.List: set item.options('position'), not item.data('position')

This commit is contained in:
rlx 2013-07-14 13:41:02 +00:00
parent a7cdb3af3d
commit c8d0969a41

View file

@ -964,17 +964,15 @@ Ox.List = function(options, self) {
} }
function moveend(data) { function moveend(data) {
var $item = self.$items[self.drag.pos]; self.$items[self.drag.pos]
$item.removeClass('OxDrag') .removeClass('OxDrag')
.css({ .css({
cursor: 'default' cursor: 'default'
}); });
that.triggerEvent('move', { that.triggerEvent('move', {
//id: id,
ids: self.$items.map(function($item) { ids: self.$items.map(function($item) {
return $item.options('data')[self.options.unique]; return $item.options('data')[self.options.unique];
}) })
//position: pos
}); });
delete self.drag; delete self.drag;
} }
@ -987,7 +985,7 @@ Ox.List = function(options, self) {
var $item = self.$items.splice(startPos, 1)[0]; var $item = self.$items.splice(startPos, 1)[0];
self.$items.splice(stopPos, 0, $item); self.$items.splice(stopPos, 0, $item);
self.$items.forEach(function($item, pos) { self.$items.forEach(function($item, pos) {
$item.data({position: pos}); $item.options({position: pos});
}); });
self.selected = [stopPos]; self.selected = [stopPos];
} }
@ -1389,8 +1387,8 @@ Ox.List = function(options, self) {
} }
function updatePositions() { function updatePositions() {
self.$items.forEach(function(item, pos) { self.$items.forEach(function($item, pos) {
item.data('position', pos); $item.options({position: pos});
}); });
} }