From e71b3b57dce6ae8e804f2e6bc38038ed28fafdb5 Mon Sep 17 00:00:00 2001 From: Rolux Date: Sat, 3 Jul 2010 10:23:39 +0200 Subject: [PATCH] better layout for text lists that don't fill the screen --- build/js/ox.ui.js | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/build/js/ox.ui.js b/build/js/ox.ui.js index 0282626..32502d2 100644 --- a/build/js/ox.ui.js +++ b/build/js/ox.ui.js @@ -2677,6 +2677,23 @@ requires } 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); !Ox.isUndefined(callback) && callback(); }, @@ -3093,8 +3110,8 @@ requires width: (self.columnWidths[i] - 9) + "px", textAlign: v.align }) - .html(data[v.id]) - .appendTo($item) + .html(!$.isEmptyObject(data) ? data[v.id] : "") + .appendTo($item); }); return $item; }