From 489a6f550291bf58ce32fdbb420e8e57d1f2011f Mon Sep 17 00:00:00 2001 From: rolux Date: Sun, 2 Jan 2011 10:52:59 +0000 Subject: [PATCH] make toggle work in splitpanel after replacing elements --- build/js/ox.ui.js | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/build/js/ox.ui.js b/build/js/ox.ui.js index 056610fc..b055fa46 100644 --- a/build/js/ox.ui.js +++ b/build/js/ox.ui.js @@ -1430,9 +1430,6 @@ requires clientXY: self.options.orientation == 'horizontal' ? 'clientY' : 'clientX', dimensions: oxui.getDimensions(self.options.orientation), // fixme: should orientation be the opposite orientation here? edges: oxui.getEdges(self.options.orientation), - ids: $.map(self.options.elements, function(element) { // fixme: needed? - return element.options('id'); - }), leftOrTop: self.options.edge == 'left' || self.options.edge == 'top', startPos: 0, startSize: 0 @@ -1490,7 +1487,7 @@ requires function toggle() { if (self.options.collapsible) { - self.options.parent.toggle(self.ids[self.leftOrTop ? 0 : 1]); + self.options.parent.toggle(self.leftOrTop ? 0 : self.options.elements.length - 1); self.options.collapsed = !self.options.collapsed; } /* @@ -9196,7 +9193,7 @@ requires that.$elements[self.resizebarElements[i][1]] ] }); - }) + }); Ox.print(self.options.elements[pos]) return that; }; @@ -9216,6 +9213,14 @@ requires that.replace(i, element.element); }); self.options.elements = elements; + self.$resizebars.forEach(function($resizebar, i) { + $resizebar.options({ + elements: [ + that.$elements[self.resizebarElements[i][0]], + that.$elements[self.resizebarElements[i][1]] + ] + }); + }); return that; } @@ -9236,6 +9241,7 @@ requires }; that.toggle = function(id) { + // one can pass pos instead of id Ox.print('toggle', id); /* // something like this is needed to load in collapsed state @@ -9248,7 +9254,8 @@ requires animate = {}; Ox.print('s.o.e', self.options.edge); */ - var pos = getPositionById(id), + Ox.print('!!!! element', self.options.elements[getPositionById(id)], getPositionById(id), id); + var pos = Ox.isNumber(id) ? id : getPositionById(id), element = self.options.elements[pos], value = parseInt(that.css(self.edges[pos == 0 ? 0 : 1])) + element.element[self.dimensions[0]]() *