Author: abelevich
Date: 2008-09-29 10:00:39 -0400 (Mon, 29 Sep 2008)
New Revision: 10598
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-09-29
13:59:58 UTC (rev 10597)
+++
trunk/ui/inplaceSelect/src/main/resources/org/richfaces/renderkit/html/scripts/inplaceselect.js 2008-09-29
14:00:39 UTC (rev 10598)
@@ -105,7 +105,7 @@
}
if (!this.attributes.showControls) {
- this.save();
+ this.save(event);
} else {
this.applyTmpValue();
}
@@ -152,7 +152,7 @@
switch (event.keyCode) {
case Event.KEY_RETURN :
this.comboList.isList = false;
- this.save();
+ this.save(event);
if (!this.attributes.showControls) {
this.tempValueKeeper.blur();
}
@@ -176,13 +176,13 @@
break;
case Event.KEY_TAB :
if (this.attributes.showControls) {
- this.save();
+ this.save(event);
}
break;
}
},
- save : function($super) {
+ save : function($super,e) {
this.applyTmpValue();
this.comboList.hide();
if (((this.attributes.closeOnSelect && !this.attributes.showControls)
&& this.comboList.isList)
@@ -190,38 +190,43 @@
//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;
- this.invokeEvent(this.events.onchange, this.inplaceSelect, "onchange",
{itemValue : unescapedValue, itemText : this.tempValueKeeper.value});
+ var params = {itemValue: unescapedValue,itemLabel: this.tempValueKeeper.value}
// var unescapeText = this.tempValueKeeper.value.unescapeHTML();
- this.setValue(unescapedValue, this.tempValueKeeper.value);
+ this.setValue(e,params);
}
},
- setValue : function(userValue, currentText) {
+ setValue : function(e, params) {
var value = this.valueKeeper.value;
- if (this.invokeEvent(this.events.onviewactivation, this.inplaceInput,
"rich:onviewactivation", {oldValue : this.valueKeeper.value, value :
this.tempValueKeeper.value})) {
+ if (this.invokeEvent(this.events.onviewactivation, this.inplaceInput,
"rich:onviewactivation", {oldValue : this.valueKeeper.value, value :
params.itemValue})) {
this.endEditableState();
- if (userValue == "") {
+ if (params.itemValue == "") {
this.setDefaultText();
this.valueKeeper.value = "";
- //this.startViewState();
+ //this.startViewState();
} else {
- if (currentText == "") {
+ if (params.itemLabel == "") {
this.setDefaultText();
} else {
- this.currentText = currentText;
+ this.currentText = params.itemLabel;
}
- this.valueKeeper.value = userValue;
+ this.valueKeeper.value = params.itemValue;
}
- if (userValue != this.value) {
+ if (params.itemValue != this.value) {
this.startChangedState();
+ if (this.tempValueKeeper != params.itemLabel) {
+ this.tempValueKeeper.value = params.itemLabel;
+ }
+ this.invokeEvent(this.events.onchange, this.inplaceSelect, "onchange",
params);
} else {
this.startViewState();
}
-
+
if (this.events.onviewactivated) {
- this.inplaceInput.fire("rich:onviewactivated", {oldValue :
this.valueKeeper.value, value : this.tempValueKeeper.value});
+ this.inplaceInput.fire("rich:onviewactivated", {oldValue : value, value :
this.valueKeeper.value});
}
}
+
},
applyTmpValue : function() {