Author: artdaw
Date: 2011-01-13 11:48:52 -0500 (Thu, 13 Jan 2011)
New Revision: 20999
Modified:
trunk/ui/input/ui/src/main/resources/META-INF/resources/org.richfaces/inplaceSelect.js
trunk/ui/input/ui/src/main/templates/inplaceSelect.template.xml
Log:
RF-9817: bug with inplaceSelect width is fixed
Modified:
trunk/ui/input/ui/src/main/resources/META-INF/resources/org.richfaces/inplaceSelect.js
===================================================================
---
trunk/ui/input/ui/src/main/resources/META-INF/resources/org.richfaces/inplaceSelect.js 2011-01-13
16:44:18 UTC (rev 20998)
+++
trunk/ui/input/ui/src/main/resources/META-INF/resources/org.richfaces/inplaceSelect.js 2011-01-13
16:48:52 UTC (rev 20999)
@@ -17,6 +17,10 @@
this.openOnEdit = mergedOptions.openOnEdit;
this.saveOnSelect = mergedOptions.saveOnSelect;
this.savedIndex = -1;
+
+ this.inputItem = $(document.getElementById(id + "Input"));
+ this.inputItemWidth = this.inputItem.width();
+ this.inputWidthDefined = options.inputWidth !== undefined;
}
rf.ui.InplaceInput.extend(rf.ui.InplaceSelect);
@@ -62,6 +66,7 @@
showPopup: function() {
this.popupList.show();
+ this.__hideLabel();
},
hidePopup: function() {
@@ -128,6 +133,7 @@
saveItemValue: function(value) {
this.selValueInput.val(value);
+ this.__showLabel();
},
getItemLabel: function(item) {
@@ -207,7 +213,21 @@
__onListMouseUp: function(e) {
this.isMouseDown = false;
this.__setInputFocus();
- }
+ },
+
+ __showLabel: function(e) {
+ this.label.show();
+ this.editContainer.css("position", "absolute");
+ this.inputItem.width(this.inputItemWidth);
+ },
+
+ __hideLabel: function(e) {
+ this.label.hide();
+ this.editContainer.css("position", "static");
+ if(!this.inputWidthDefined) {
+ this.inputItem.width(this.label.width());
+ }
+ }
}
})());
Modified: trunk/ui/input/ui/src/main/templates/inplaceSelect.template.xml
===================================================================
--- trunk/ui/input/ui/src/main/templates/inplaceSelect.template.xml 2011-01-13 16:44:18
UTC (rev 20998)
+++ trunk/ui/input/ui/src/main/templates/inplaceSelect.template.xml 2011-01-13 16:48:52
UTC (rev 20999)
@@ -104,7 +104,7 @@
<cdk:scriptOption name="changedCss"
value="#{concatClasses('rf-is-c-s',
component.attributes['changedStateClass'])}"/>
<cdk:scriptOption name="editCss"
value="#{concatClasses('rf-is-e-s',
component.attributes['editStateClass'])}"/>
<cdk:scriptOption name="selectItemCss"
value="#{concatClasses('rf-is-sel',
component.attributes['selectItemClass'])}"/>
- <cdk:scriptOption attributes="editEvent state defaultLabel saveOnBlur
showControls openOnEdit saveOnSelect" />
+ <cdk:scriptOption attributes="editEvent state defaultLabel saveOnBlur
showControls openOnEdit saveOnSelect inputWidth" />
<cdk:scriptOption attributes="onbegin oncomplete onerror
onbeforedomupdate onselectitem onchange onblur onfocus"
wrapper="eventHandler"/>
</cdk:scriptObject>
new RichFaces.ui.InplaceSelect("#{clientId}", #{toScriptArgs(options)});