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