Author: vmolotkov
Date: 2008-03-26 15:45:25 -0400 (Wed, 26 Mar 2008)
New Revision: 7276
Modified:
trunk/ui/inplaceSelect/src/main/resources/org/richfaces/renderkit/html/scripts/inplaceselect.js
Log:
RF-2685, 2656
Modified:
trunk/ui/inplaceSelect/src/main/resources/org/richfaces/renderkit/html/scripts/inplaceselect.js
===================================================================
---
trunk/ui/inplaceSelect/src/main/resources/org/richfaces/renderkit/html/scripts/inplaceselect.js 2008-03-26
18:42:33 UTC (rev 7275)
+++
trunk/ui/inplaceSelect/src/main/resources/org/richfaces/renderkit/html/scripts/inplaceselect.js 2008-03-26
19:45:25 UTC (rev 7276)
@@ -70,8 +70,11 @@
if (!this.comboList.isList || this.clickOnBar) {
this.comboList.hideWithDelay();
}
- if (this.attributes.showControls) {
+
+ if (!this.attributes.showControls) {
this.saveValue();
+ } else {
+ this.applyTmpValue();
}
this.comboList.isList = false;
/*this.comboList.hideWithDelay();*/
@@ -128,16 +131,19 @@
},
saveValue : function($super) {
+ this.applyTmpValue();
+ if (!this.comboList.isList || this.clickOnBar) {
+ this.save(this.currentItemValue, this.tempValueKeeper.value);
+ }
+ },
+
+ applyTmpValue : function() {
if (this.comboList.activeItem) {
var userLabel = this.comboList.activeItem.innerHTML;
this.currentItemValue = this.comboList.activeItem.value;
this.tempValueKeeper.value = userLabel;
this.comboList.selectedItem = this.comboList.activeItem;
- //this.clickOnField = false;
}
- if (!this.comboList.isList || this.clickOnBar) {
- this.save(this.currentItemValue, this.tempValueKeeper.value);
- }
},
deleteViewArtifacts : function () {
@@ -149,5 +155,25 @@
getCurrentText : function() {
return this.inplaceInput.childNodes[6];
+ },
+
+ getLabelItem : function(value) {
+ var length = this.comboList.getItems().length;
+ for (var i = 0; i < length; i++) {
+ var item = this.comboList.getItems()[i];
+ if (item.value == value) {
+ return item;
+ }
+ }
+ },
+
+ cancel : function($super, e) {
+ var item = this.getLabelItem(this.valueKeeper.value);
+ if (this.comboList.selectedItem) {
+ this.comboList.doNormalItem(this.comboList.selectedItem);
+ }
+ this.comboList.doSelectItem(item);
+ $super(e, item.innerHTML);
}
+
});
Show replies by date