From 1f8f9ffa7dfb78b6398a1fe9db200ffb51aa0fa3 Mon Sep 17 00:00:00 2001 From: rolux Date: Wed, 4 Apr 2012 19:09:10 +0200 Subject: [PATCH] some quick and ugly fixes to make TreeList work again --- examples/cities/js/example.js | 2 +- source/Ox.UI/js/List/Ox.List.js | 8 ++++---- source/Ox.UI/js/List/Ox.TreeList.js | 5 +++-- 3 files changed, 8 insertions(+), 7 deletions(-) diff --git a/examples/cities/js/example.js b/examples/cities/js/example.js index 0af5e8fd..61383eaf 100644 --- a/examples/cities/js/example.js +++ b/examples/cities/js/example.js @@ -7,7 +7,7 @@ /* Since we will be doing some mapping, we have to load the Geo module. */ -Ox.load({UI: {}, Geo: {}}, function() { +Ox.load({UI: {showScreen: true}, Geo: {}}, function() { Ox.getJSON('json/cities.json', function(cities) { diff --git a/source/Ox.UI/js/List/Ox.List.js b/source/Ox.UI/js/List/Ox.List.js index ac74ec36..84e0efd5 100644 --- a/source/Ox.UI/js/List/Ox.List.js +++ b/source/Ox.UI/js/List/Ox.List.js @@ -1463,9 +1463,9 @@ Ox.List = function(options, self) { $item.insertAfter($items[i - 1]); } }); - self.options.items.splice.apply(self.options.items, Ox.merge([pos, 0], items)); + ///////self.options.items.splice.apply(self.options.items, Ox.merge([pos, 0], items)); self.$items.splice.apply(self.$items, Ox.merge([pos, 0], $items)); - self.listLength = self.options.items.length; + ///////self.listLength = self.options.items.length; //loadItems(); updatePositions(); } @@ -1569,14 +1569,14 @@ Ox.List = function(options, self) { self.selected.indexOf(i) > -1 && deselect(i); self.$items[i].remove(); }); - self.options.items.splice(pos, length); + ///////self.options.items.splice(pos, length); self.$items.splice(pos, length); self.selected.forEach(function(v, i) { if (v >= pos + length) { self.selected[i] -= length; } }); - self.listLength = self.options.items.length; + ///////self.listLength = self.options.items.length; updatePositions(); } } diff --git a/source/Ox.UI/js/List/Ox.TreeList.js b/source/Ox.UI/js/List/Ox.TreeList.js index a9d5d72a..f41cd3c8 100644 --- a/source/Ox.UI/js/List/Ox.TreeList.js +++ b/source/Ox.UI/js/List/Ox.TreeList.js @@ -48,6 +48,7 @@ Ox.TreeList = function(options, self) { itemHeight: 16, items: parseItems(), itemWidth: self.options.width, + keys: ['expanded', 'id', 'items', 'level', 'title'], max: self.options.max, min: self.options.min, unique: 'id' @@ -73,7 +74,7 @@ Ox.TreeList = function(options, self) { } function constructItem(data) { - var $item = $('
'), //.css({width: self.options.width + 'px'}), + var $item = $('
').css({width: self.options.width + 'px'}), padding = (data.level + !data.items) * 16 - 8; if (data.level || !data.items) { $('
') @@ -111,7 +112,7 @@ Ox.TreeList = function(options, self) { .css({ width: (self.options.width - padding - 32 + !data.items * 16) + 'px' }) - .html(data.title) + .html(data.title || '') .appendTo($item); return $item; }