better layout for text lists that don't fill the screen

This commit is contained in:
Rolux 2010-07-03 10:23:39 +02:00
parent 74205d988b
commit 11fe22e879

View file

@ -2677,6 +2677,23 @@ requires
} }
self.$items[pos].appendTo(self.$pages[page]); self.$items[pos].appendTo(self.$pages[page]);
}); });
if (self.options.type == "text" && page == 0) {
var height = that.height(),
visibleItems = Math.ceil(height / self.options.itemHeight);
if (result.data.items.length < visibleItems) {
self.$pages[page].height(height).css({
overflow: "hidden"
});
$.each(Ox.range(result.data.items.length, visibleItems), function(i, v) {
new Ox.ListItem({
construct: self.options.construct,
data: {},
id: "",
position: v
}).appendTo(self.$pages[page]);
});
}
}
self.$pages[page].appendTo(that.$content); self.$pages[page].appendTo(that.$content);
!Ox.isUndefined(callback) && callback(); !Ox.isUndefined(callback) && callback();
}, },
@ -3093,8 +3110,8 @@ requires
width: (self.columnWidths[i] - 9) + "px", width: (self.columnWidths[i] - 9) + "px",
textAlign: v.align textAlign: v.align
}) })
.html(data[v.id]) .html(!$.isEmptyObject(data) ? data[v.id] : "")
.appendTo($item) .appendTo($item);
}); });
return $item; return $item;
} }