Author: vmolotkov
Date: 2008-03-28 09:52:42 -0400 (Fri, 28 Mar 2008)
New Revision: 7364
Modified:
trunk/ui/inplaceSelect/src/main/resources/org/richfaces/renderkit/html/scripts/inplaceselect.js
Log:
http://jira.jboss.com/jira/browse/RF-2810
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-28
13:44:51 UTC (rev 7363)
+++
trunk/ui/inplaceSelect/src/main/resources/org/richfaces/renderkit/html/scripts/inplaceselect.js 2008-03-28
13:52:42 UTC (rev 7364)
@@ -8,10 +8,11 @@
this.inplaceSelect = $(clientId);
this.inplaceSelect.component = this;
+ this.attrCloseOnSelect = true; //will be corrected in a future version
(
http://jira.jboss.com/jira/browse/RF-2814)
+
this.currentItemValue = this.value;
this.button.style.top = Richfaces.getBorderWidth(this.tempValueKeeper, "t") +
"px";
this["rich:destructor"] = "destroy";
-
},
destroy: function() {
@@ -22,7 +23,6 @@
initHandlers : function($super) {
$super();
this.tempValueKeeper.observe("click",
function(e){this.tempKeeperClickHandler(e);}.bindAsEventListener(this));
- this.tempValueKeeper.observe("keydown",
function(e){this.tmpValueKeyDownHandlerIn(e);}.bindAsEventListener(this));
this.button.observe("click",
function(e){this.buttonClickHandler(e);}.bindAsEventListener(this));
@@ -74,20 +74,22 @@
},
tmpValueBlurHandler : function($super, event) {
- $super(event);
+ if ($super(event)) {
+
+
- if (!this.comboList.isList || this.clickOnBar) {
- this.comboList.hideWithDelay();
- }
if (!this.attributes.showControls) {
this.save();
} else {
this.applyTmpValue();
}
+ if (!this.comboList.isList || this.clickOnBar) {
+ this.comboList.hideWithDelay();
+ }
+
this.comboList.isList = false;
- /*this.comboList.hideWithDelay();*/
-
+ }
},
listClickHandler : function(event) {
@@ -116,11 +118,18 @@
} else {
this.comboList.isList = true;
}
+
+ if (this.attrCloseOnSelect) {
+ //bug :
http://jira.jboss.com/jira/browse/RF-2810,
+ //will be corrected in a future version (
http://jira.jboss.com/jira/browse/RF-2814)
+ this.comboList.isList = false;
+ }
},
- tmpValueKeyDownHandlerIn : function(event) {
+ tmpValueKeyDownHandler : function(event) {
switch (event.keyCode) {
- case Event.KEY_RETURN :
+ case Event.KEY_RETURN :
+ this.comboList.isList = false;
this.save();
this.comboList.hideWithDelay();
Event.stop(event);
@@ -136,13 +145,18 @@
case Event.KEY_ESC :
this.comboList.resetSelection();
this.comboList.hideWithDelay();
+ this.cancel(event);
break;
+ case Event.KEY_TAB :
+ this.save();
+ this.byTab = true;
+ break;
}
},
save : function($super) {
this.applyTmpValue();
- if ((!this.comboList.isList || this.clickOnBar)) {
+ if (!this.comboList.isList || this.clickOnBar) {
this.saveValue(this.currentItemValue, this.tempValueKeeper.value);
}