Author: abelevich
Date: 2008-03-27 15:30:16 -0400 (Thu, 27 Mar 2008)
New Revision: 7333
Modified:
trunk/ui/inplaceSelect/src/main/resources/org/richfaces/renderkit/html/scripts/inplaceselect.js
Log:
add support for component control, fix js api
http://jira.jboss.com/jira/browse/RF-2798,
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-27
19:21:31 UTC (rev 7332)
+++
trunk/ui/inplaceSelect/src/main/resources/org/richfaces/renderkit/html/scripts/inplaceselect.js 2008-03-27
19:30:16 UTC (rev 7333)
@@ -5,11 +5,20 @@
this.comboList = listObj;
$super(clientId, temValueKeepId, valueKeepId, tabberId, attributes, events, classes,
barParams);
this.clickOnBar = false;
-
+ this.inplaceSelect = $(clientId);
+ this.inplaceSelect.component = this;
+
this.currentItemValue = this.value;
this.button.style.top = Richfaces.getBorderWidth(this.tempValueKeeper, "t") +
"px";
+ this["rich:destructor"] = "destroy";
+
},
+ destroy: function() {
+ this.inplaceSelect.component = null;
+ },
+
+
initHandlers : function($super) {
$super();
this.tempValueKeeper.observe("click",
function(e){this.tempKeeperClickHandler(e);}.bindAsEventListener(this));
@@ -72,7 +81,7 @@
}
if (!this.attributes.showControls) {
- this.saveValue();
+ this.save();
} else {
this.applyTmpValue();
}
@@ -112,7 +121,7 @@
tmpValueKeyDownHandlerIn : function(event) {
switch (event.keyCode) {
case Event.KEY_RETURN :
- this.saveValue();
+ this.save();
this.comboList.hideWithDelay();
Event.stop(event);
break;
@@ -131,10 +140,10 @@
}
},
- saveValue : function($super) {
+ save : function($super) {
this.applyTmpValue();
- if ((!this.comboList.isList || this.clickOnBar) && this.tempValueKeeper.value)
{
- this.save(this.currentItemValue, this.tempValueKeeper.value);
+ if ((!this.comboList.isList || this.clickOnBar)) {
+ this.saveValue(this.currentItemValue, this.tempValueKeeper.value);
}
this.comboList.hide();
},
@@ -171,12 +180,22 @@
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);
if (item) {
this.comboList.resetSelection();
this.comboList.doSelectItem(item);
$super(e, item.innerHTML);
- this.comboList.hide();
+ } else {
+ $super(e, "");
+ this.comboList.resetSelection();
}
+
+ this.comboList.hide();
}
+});
-});
+