load items for empty lists

This commit is contained in:
j 2011-02-25 16:04:26 +01:00
parent ff4798b421
commit 80649e4533

View file

@ -7656,7 +7656,8 @@ requires
that.addItems = function(pos, items) { that.addItems = function(pos, items) {
var $items = [], var $items = [],
length = items.length; length = items.length
first = self.$items.length == 0;
self.selected.forEach(function(v, i) { self.selected.forEach(function(v, i) {
if (v >= pos) { if (v >= pos) {
self.selected[i] += length; self.selected[i] += length;
@ -7681,8 +7682,11 @@ requires
$item.insertAfter($items[i - 1]); $item.insertAfter($items[i - 1]);
} }
}); });
self.options.items.splice.apply(self.options.items, $.merge([pos, 0], items)); self.options.items.splice.apply(self.options.items, $.merge([pos, 0], items));
self.$items.splice.apply(self.$items, $.merge([pos, 0], $items)); self.$items.splice.apply(self.$items, $.merge([pos, 0], $items));
if(first)
loadItems();
updatePositions(); updatePositions();
} }