Author: abelevich
Date: 2008-01-25 12:15:29 -0500 (Fri, 25 Jan 2008)
New Revision: 5644
Modified:
trunk/sandbox/ui/combobox/src/main/resources/org/richfaces/renderkit/html/scripts/combobox.js
Log:
Modified:
trunk/sandbox/ui/combobox/src/main/resources/org/richfaces/renderkit/html/scripts/combobox.js
===================================================================
---
trunk/sandbox/ui/combobox/src/main/resources/org/richfaces/renderkit/html/scripts/combobox.js 2008-01-25
16:24:45 UTC (rev 5643)
+++
trunk/sandbox/ui/combobox/src/main/resources/org/richfaces/renderkit/html/scripts/combobox.js 2008-01-25
17:15:29 UTC (rev 5644)
@@ -19,12 +19,12 @@
this.button = $(buttonId);
this.buttonBG = $(buttonBGId);
- var fieldDem = Richfaces.ComboBoxList.getElemXY(this.field);
- fieldDem.height = this.field.offsetHeight;
+// var fieldDem = Richfaces.ComboBoxList.getElemXY(this.field);
+// fieldDem.height = this.field.offsetHeight;
listWidth = (!listWidth) ? this.getCurrentWidth() : listWidth;
this.comboList = new Richfaces.ComboBoxList(listId, parentListId, iframeId,
selectFirstOnUpdate, classes.COMBO_LIST, listWidth,
- listHeight, itemsText, onlistcall, fieldDem, showDelay, hideDelay);
+ listHeight, itemsText, onlistcall, fieldId, showDelay, hideDelay);
this.defaultMessage = defaultMessage;
if (value) {
var item = this.comboList.findItemBySubstr(value);
@@ -344,13 +344,13 @@
Richfaces.ComboBoxList = Class.create();
Richfaces.ComboBoxList.prototype = {
- initialize: function(listId, parentListId, iframeId, selectFirstOnUpdate, classes,
width, height, itemsText, onlistcall, fieldXY,
+ initialize: function(listId, parentListId, iframeId, selectFirstOnUpdate, classes,
width, height, itemsText, onlistcall, fieldId,
showDelay, hideDelay) {
this.list = $(listId);
this.listParent = $(parentListId);
this.iframe = $(iframeId);
-
+ this.fieldElem = $(fieldId);
this.itemsText = itemsText;
this.onlistcall = onlistcall;
@@ -373,8 +373,8 @@
this.width = width;
this.height = height;
- this.fieldDimensions = fieldXY;
this.initDimensions();
+
},
initDimensions : function() {
@@ -385,7 +385,7 @@
Richfaces.ComboBoxList.LAYOUT_BORDER_H = Richfaces.getBorderWidth(this.listParent,
"lr");
Richfaces.ComboBoxList.LAYOUT_PADDING_V = Richfaces.getPaddingWidth(this.listParent,
"tb");
Richfaces.ComboBoxList.LAYOUT_PADDING_H = Richfaces.getPaddingWidth(this.listParent,
"lr");
-
+
this.listParent.hide();
this.listParent.style.visibility = "visible";
},
@@ -410,7 +410,11 @@
},
show : function() {
+ this.fieldDimensions = Richfaces.ComboBoxList.getElemXY(this.fieldElem);
+ this.fieldDimensions.height = this.fieldElem.offsetHeight;
+
this.setSize();
+
this.setPosition(this.fieldDimensions.top, this.fieldDimensions.left,
this.fieldDimensions.height);
if (this.selectedItem) {
@@ -655,14 +659,31 @@
}
Richfaces.ComboBoxList.getElemXY = function(elem) {
+
+ // for FF support
+ var originalVisibility = elem.style.visibility;
+ var originalPosition = elem.style.position;
+ var originalDisplay = elem.style.display;
+
+ elem.style.visibility = 'hidden';
+ elem.style.position = 'absolute';
+ elem.style.display = 'block';
+
var x = elem.offsetLeft;
var y = elem.offsetTop;
-
- for (var parent = elem.offsetParent; parent; parent = parent.offsetParent) {
- x += parent.offsetLeft;
- y += parent.offsetTop;
- }
- return {left: x, top: y};
+
+
+ for (var parent = Element.getOffsetParent(elem); parent != document.body; parent =
Element.getOffsetParent(parent)) {
+ x += parent.offsetLeft;
+ y += parent.offsetTop;
+ }
+
+ elem.style.display = originalDisplay;
+ elem.style.visibility = originalVisibility;
+ elem.style.position = originalPosition;
+
+
+ return {left: x, top: y};
}
Richfaces.ComboBox.textboxSelect = function(oTextbox, iStart, iEnd) {