Author: abelevich
Date: 2008-12-10 12:31:26 -0500 (Wed, 10 Dec 2008)
New Revision: 11708
Modified:
trunk/ui/inplaceSelect/src/main/resources/org/richfaces/renderkit/html/scripts/inplaceselect.js
Log:
https://jira.jboss.org/jira/browse/RF-4190
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-12-10
17:23:41 UTC (rev 11707)
+++
trunk/ui/inplaceSelect/src/main/resources/org/richfaces/renderkit/html/scripts/inplaceselect.js 2008-12-10
17:31:26 UTC (rev 11708)
@@ -191,50 +191,52 @@
//bug :
http://jira.jboss.com/jira/browse/RF-2810,
//will be corrected in a future version (
http://jira.jboss.com/jira/browse/RF-2814)
var unescapedValue = this.currentItemValue;
- var params = {itemValue: unescapedValue,itemLabel: this.tempValueKeeper.value}
+ // var params = {itemValue: unescapedValue,itemLabel: this.tempValueKeeper.value}
// var unescapeText = this.tempValueKeeper.value.unescapeHTML();
- this.setValue(e,params);
+ this.setValue(e,unescapedValue);
}
},
- getParameters : function (args) {
- var result = {};
- var label = args[1]['itemLabel'];
- if(label) {
- var value = args[1]['itemValue'];
- result.itemLabel = label;
- result.itemValue = value;
- } else {
- result.itemLabel = args[0];
- result.itemValue = args[1];
- }
- return result;
- },
+ findLabel : function(lookupItems, value) {
+ var items = lookupItems;
+ for(var i=0; i < items.length; i++) {
+ if(items[i][1] == value) {
+ return items[i][0];
+ }
+ }
+ },
- setValue : function(e, params) {
- var args = $A(arguments);
- var params = this.getParameters(args);
+ setValue : function(e, param) {
+ var item = {};
+ item.itemValue = this.getParameters(e,param,"value");
+ item.itemLabel = this.findLabel(this.comboList.itemsText,item.itemValue);
+
+ if (!item.itemLabel) {
+ item.itemValue = this.currentItemValue;
+ item.itemLabel = this.tempValueKeeper.value;
+ }
+
var value = this.valueKeeper.value;
- if (this.invokeEvent(this.events.onviewactivation, this.inplaceInput,
"rich:onviewactivation", {oldValue : this.valueKeeper.value, value :
params.itemValue})) {
+ if (this.invokeEvent(this.events.onviewactivation, this.inplaceInput,
"rich:onviewactivation", {oldValue : this.valueKeeper.value, value :
item.itemValue})) {
this.endEditableState();
- if (params.itemValue == "") {
+ if (item.itemValue == "") {
this.setDefaultText();
this.valueKeeper.value = "";
//this.startViewState();
} else {
- if (params.itemLabel == "") {
+ if (item.itemLabel == "") {
this.setDefaultText();
} else {
- this.currentText = params.itemLabel;
+ this.currentText = item.itemLabel;
}
- this.valueKeeper.value = params.itemValue;
+ this.valueKeeper.value = item.itemValue;
}
- if (params.itemValue != this.value) {
+ if (item.itemValue != this.value) {
this.startChangedState();
- if (this.tempValueKeeper != params.itemLabel) {
- this.tempValueKeeper.value = params.itemLabel;
+ if (this.tempValueKeeper != item.itemLabel) {
+ this.tempValueKeeper.value = item.itemLabel;
}
- this.invokeEvent(this.events.onchange, this.inplaceSelect, "onchange",
params);
+ this.invokeEvent(this.events.onchange, this.inplaceSelect, "onchange",
item.itemValue);
} else {
this.startViewState();
}