Author: abelevich
Date: 2008-09-29 09:59:58 -0400 (Mon, 29 Sep 2008)
New Revision: 10597
Modified:
trunk/ui/inplaceInput/src/main/resources/org/richfaces/renderkit/html/scripts/inplaceinput.js
trunk/ui/inplaceInput/src/main/templates/inplaceinput.jspx
Log:
fix onchange event calling, setValue via componentControl support
Modified:
trunk/ui/inplaceInput/src/main/resources/org/richfaces/renderkit/html/scripts/inplaceinput.js
===================================================================
---
trunk/ui/inplaceInput/src/main/resources/org/richfaces/renderkit/html/scripts/inplaceinput.js 2008-09-29
13:09:43 UTC (rev 10596)
+++
trunk/ui/inplaceInput/src/main/resources/org/richfaces/renderkit/html/scripts/inplaceinput.js 2008-09-29
13:59:58 UTC (rev 10597)
@@ -125,7 +125,7 @@
}
},
- tmpValueBlurHandler : function() {
+ tmpValueBlurHandler : function(e) {
if (this.skipBlur) {
this.skipBlur = false;
return;
@@ -137,7 +137,7 @@
}
if (!this.attributes.showControls) {
- this.save();
+ this.save(e);
}
},
@@ -161,14 +161,14 @@
break;
case Event.KEY_TAB :
if (this.attributes.showControls) {
- this.save();
+ this.save(e);
}
break;
}
},
okHandler : function(e) {
- this.save();
+ this.save(e);
Event.stop(e);
},
@@ -245,7 +245,10 @@
if (this.currentState != 1) {
return;
}
+
+
var width = parseInt(this.attributes.inputWidth);
+
if (!width) {
var max = parseInt(this.attributes.maxInputWidth);
var min = parseInt(this.attributes.minInputWidth);
@@ -257,6 +260,7 @@
width = textWidth;
}
}
+
this.tempValueKeeper.style.width = width + "px";
return width;
},
@@ -292,20 +296,21 @@
}
},
- save : function() {
+ save : function(e) {
if (this.invokeEvent(this.events.onviewactivation, this.inplaceInput,
"rich:onviewactivation", {oldValue : this.valueKeeper.value, value :
this.tempValueKeeper.value})) {
- var userValue = this.tempValueKeeper.value;
- this.setValue(userValue);
+ var userValue = {value:this.tempValueKeeper.value};
+ this.setValue(e,userValue);
if (this.events.onviewactivated) {
this.inplaceInput.fire("rich:onviewactivated", {oldValue :
this.valueKeeper.value, value : this.tempValueKeeper.value});
}
}
},
- setValue : function(userValue) {
+ setValue : function(e, param) {
var value = this.valueKeeper.value;
+ var userValue = param.value;
this.endEditableState();
-
+
if (userValue.blank()) {
this.setDefaultText();
this.valueKeeper.value = "";
@@ -316,6 +321,10 @@
if (userValue != this.value) {
this.startChangedState();
+ if (this.tempValueKeeper != userValue) {
+ this.tempValueKeeper.value = userValue;
+ }
+ this.invokeEvent(this.events.onchange, this.inplaceSelect, "onchange",
param);
} else {
this.startViewState();
}
Modified: trunk/ui/inplaceInput/src/main/templates/inplaceinput.jspx
===================================================================
--- trunk/ui/inplaceInput/src/main/templates/inplaceinput.jspx 2008-09-29 13:09:43 UTC
(rev 10596)
+++ trunk/ui/inplaceInput/src/main/templates/inplaceinput.jspx 2008-09-29 13:59:58 UTC
(rev 10597)
@@ -92,7 +92,6 @@
type='text'
autocomplete="off"
value='#{fieldValue}'
- onchange='#{component.attributes["onchange"]}'
onselect='#{component.attributes["onselect"]}'
onblur='#{component.attributes["onblur"]}'
onfocus='#{component.attributes["onfocus"]}'
Show replies by date