forked from 0x2620/oxjs
fix a bug where in empty icon lists, an icon grid would appear for a split-second
This commit is contained in:
parent
3a87e8eb5f
commit
90e795d194
4 changed files with 19 additions and 16 deletions
|
|
@ -65,7 +65,7 @@ Ox.List = function(options, self) {
|
|||
.options(options || {})
|
||||
.scroll(scroll);
|
||||
|
||||
that.$content.mousedown(_mousedown);
|
||||
that.mousedown(_mousedown);
|
||||
//that.bindEvent('doubleclick', function() {alert('d')})
|
||||
/*
|
||||
that.$content.bindEvent({ // fixme: port to new Ox mouse events
|
||||
|
|
@ -283,13 +283,11 @@ Ox.List = function(options, self) {
|
|||
|
||||
function constructEmptyPage(page) {
|
||||
var i, $page = Ox.ListPage().css(getPageCSS(page));
|
||||
for (i = 0; i < getPageLength(page); i++
|
||||
) {
|
||||
// fixme: why does chainging fail here?
|
||||
Ox.loop(getPageLength(page), function() {
|
||||
Ox.ListItem({
|
||||
construct: self.options.construct
|
||||
}).appendTo($page);
|
||||
}
|
||||
});
|
||||
return $page;
|
||||
}
|
||||
|
||||
|
|
@ -556,7 +554,7 @@ Ox.List = function(options, self) {
|
|||
|
||||
function getPageLength(page) {
|
||||
var mod = self.listLength % self.pageLength;
|
||||
return page < self.pages - 1 || mod == 0 ? self.pageLength : mod;
|
||||
return page < self.pages - 1 || (self.listLength && mod == 0) ? self.pageLength : mod;
|
||||
}
|
||||
|
||||
function getPositionById(id) {
|
||||
|
|
@ -699,6 +697,7 @@ Ox.List = function(options, self) {
|
|||
offset = page * self.pageLength,
|
||||
range = [offset, offset + getPageLength(page)];
|
||||
if (Ox.isUndefined(self.$pages[page])) { // fixme: unload will have made this undefined already
|
||||
Ox.print('###################################', self.listLength, getPageLength(0))
|
||||
self.$pages[page] = constructEmptyPage(page);
|
||||
self.options.type == 'text' && page == 0 && fillFirstPage();
|
||||
self.$pages[page].appendTo(that.$content);
|
||||
|
|
@ -1239,7 +1238,7 @@ Ox.List = function(options, self) {
|
|||
self.pageLength = self.options.orientation == 'both' ?
|
||||
self.pageLengthByRowLength[self.rowLength] :
|
||||
self.options.pageLength;
|
||||
$.extend(self, {
|
||||
Ox.extend(self, {
|
||||
listLength: result.data.items,
|
||||
pages: Math.max(Math.ceil(result.data.items / self.pageLength), 1),
|
||||
pageWidth: self.options.orientation == 'vertical' ? 0 :
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue