fixes for groups

This commit is contained in:
rolux 2010-12-22 14:16:15 +00:00
parent f0aa0f8b53
commit 0ce8636b18

View file

@ -5934,9 +5934,10 @@ requires
unique: ''
})
.options(options || {})
.mousedown(mousedown)
.scroll(scroll);
that.$content.mousedown(mousedown);
$.extend(self, {
$items: [],
$pages: [],
@ -6121,6 +6122,7 @@ requires
}
function findItem(e) {
Ox.print('---- findItem', e.target)
var $element = $(e.target),
$item = null;
while (!$element.hasClass('OxTarget') && !$element.hasClass('OxPage') && !$element.is('body')) {
@ -6185,7 +6187,7 @@ requires
}
function getPageByPosition(pos) {
return parseInt(self.options.pageLength / pos);
return parseInt(pos / self.options.pageLength);
}
function getPositions() {
@ -6194,6 +6196,12 @@ requires
}));
// fixme: optimize: send non-selected ids if more than half of the items are selected
if (self.selected.length /*&& self.selected.length < self.listLength*/) {
Ox.print('-- request', {
ids: $.map(self.selected, function(v, i) {
return self.ids[v];
}),
sort: self.options.sort
});
self.requests.push(self.options.request({
ids: $.map(self.selected, function(v, i) {
return self.ids[v];
@ -6222,6 +6230,7 @@ requires
}
that.scrollTop(0);
that.$content.empty();
Ox.print('self.selected', self.selected, 'self.page', self.page);
loadPages(self.page, function() {
scrollTo(pos);
});
@ -6279,6 +6288,7 @@ requires
offset = page * self.pageLength,
range = [offset, offset + (page < self.pages - 1 ?
self.pageLength : self.listLength % self.pageLength)];
Ox.print('is page', page, 'undefined?', Ox.isUndefined(self.$pages[page]))
if (Ox.isUndefined(self.$pages[page])) { // fixme: unload will have made this undefined already
self.requests.push(self.options.request({
keys: keys,
@ -6306,6 +6316,7 @@ requires
});
self.ids[pos] = v[self.options.unique];
if (isSelected(pos)) {
Ox.print('pos', pos, 'isSelected')
self.$items[pos].addClass('OxSelected');
}
self.$items[pos].appendTo(self.$pages[page]);