From 2df5d05980a1ec4c492cdca649bb5e1429424e2f Mon Sep 17 00:00:00 2001 From: rlx <0x0073@0x2620.org> Date: Sat, 5 Nov 2011 11:44:31 +0000 Subject: [PATCH] fix regressions introduced by garbage collection --- source/Ox.UI/js/Core/Ox.Element.js | 6 ++++-- source/Ox.UI/js/List/Ox.ListItem.js | 5 +++-- source/Ox.UI/js/List/Ox.TextList.js | 7 ++++--- 3 files changed, 11 insertions(+), 7 deletions(-) diff --git a/source/Ox.UI/js/Core/Ox.Element.js b/source/Ox.UI/js/Core/Ox.Element.js index 1c4fa35c..1e2c6545 100644 --- a/source/Ox.UI/js/Core/Ox.Element.js +++ b/source/Ox.UI/js/Core/Ox.Element.js @@ -376,8 +376,10 @@ Ox.Element = function(options, self) { }; that.setElement = function($element) { - that.$element.replaceWith(that.$element = $element); - that.$element.data({oxid: that.id}); + //$element[0].className = that.$element[0].className; + $element.addClass('OxElement').data({oxid: that.id}); + that.$element.replaceWith($element); + that.$element = $element; that[0] = that.$element[0]; }; diff --git a/source/Ox.UI/js/List/Ox.ListItem.js b/source/Ox.UI/js/List/Ox.ListItem.js index 237c4d96..e1e94066 100644 --- a/source/Ox.UI/js/List/Ox.ListItem.js +++ b/source/Ox.UI/js/List/Ox.ListItem.js @@ -40,10 +40,11 @@ Ox.ListItem = function(options, self) { }); if (update) { that.$element.hasClass('OxSelected') && $element.addClass('OxSelected'); - //that.$element.replaceWith($element); + // that.$element.replaceWith($element); } - //that.$element = $element; + // that.$element = $element; that.setElement($element); + Ox.print('LISTITEM', that.$element.data('id')) } self.setOption = function(key, value) { diff --git a/source/Ox.UI/js/List/Ox.TextList.js b/source/Ox.UI/js/List/Ox.TextList.js index 655d0d22..ee0b721f 100644 --- a/source/Ox.UI/js/List/Ox.TextList.js +++ b/source/Ox.UI/js/List/Ox.TextList.js @@ -588,7 +588,7 @@ Ox.TextList = function(options, self) { function getCell(id, key) { Ox.Log('List', 'getCell', id, key) var $item = getItem(id); - key = key || ''; + key = key || ''; // fixme: what is this? return $($item.find('.OxCell.OxColumn' + Ox.toTitleCase(key))[0]); } @@ -611,7 +611,7 @@ Ox.TextList = function(options, self) { function getItem(id) { //Ox.Log('List', 'getItem', id) var $item = null; - that.find('.OxItem').each(function() { + that.$element.find('.OxItem').each(function() { $this = $(this); if ($this.data('id') == id) { $item = $this; @@ -737,12 +737,13 @@ Ox.TextList = function(options, self) { that.$element.find('.OxCell.OxColumn' + Ox.toTitleCase(self.options.columns[i].id)).css({ width: width - (self.options.columnsVisible ? 9 : 8) + 'px' }); + Ox.Log('??? resize column') setWidth(); } function setWidth() { var width = getItemWidth(); - that.$body.$content.find('.OxItem').css({ // fixme: can we avoid this lookup? + that.$body.$content.$element.find('.OxItem').css({ // fixme: can we avoid this lookup? width: width + 'px' }); that.$body.$content.css({