summaryrefslogtreecommitdiff
path: root/framework/Web/Javascripts/prado/activecontrols/inlineeditor.js
diff options
context:
space:
mode:
Diffstat (limited to 'framework/Web/Javascripts/prado/activecontrols/inlineeditor.js')
-rw-r--r--framework/Web/Javascripts/prado/activecontrols/inlineeditor.js28
1 files changed, 23 insertions, 5 deletions
diff --git a/framework/Web/Javascripts/prado/activecontrols/inlineeditor.js b/framework/Web/Javascripts/prado/activecontrols/inlineeditor.js
index fdf0e9f5..f8b8b412 100644
--- a/framework/Web/Javascripts/prado/activecontrols/inlineeditor.js
+++ b/framework/Web/Javascripts/prado/activecontrols/inlineeditor.js
@@ -1,11 +1,12 @@
Prado.WebUI.TInPlaceTextBox = Base.extend(
{
- isSaving : false,
- isEditing : false,
- editField : null,
-
constructor : function(options)
{
+
+ this.isSaving = false;
+ this.isEditing = false;
+ this.editField = null;
+
this.options = Object.extend(
{
LoadTextFromSource : false,
@@ -140,6 +141,7 @@ Prado.WebUI.TInPlaceTextBox = Base.extend(
}
Event.observe(this.editField, "blur", this.onTextBoxBlur.bind(this));
+ Event.observe(this.editField, "keypress", this.onKeyPressed.bind(this));
},
/**
@@ -163,7 +165,10 @@ Prado.WebUI.TInPlaceTextBox = Base.extend(
{
text = this.element.innerHTML;
if(this.options.AutoPostBack && text != this.editField.value)
- this.onTextChanged(text);
+ {
+ if(this.isEditing)
+ this.onTextChanged(text);
+ }
else
{
this.element.innerHTML = this.editField.value;
@@ -173,6 +178,19 @@ Prado.WebUI.TInPlaceTextBox = Base.extend(
}
},
+ onKeyPressed : function(e)
+ {
+ if (Event.keyCode(e) == Event.KEY_ESC)
+ {
+ this.editField.value = this.getText();
+ this.isEditing = false;
+ if(this.options.AutoHide)
+ this.showLabel();
+ }
+ else if (Event.keyCode(e) == Event.KEY_RETURN)
+ Event.stop(e);
+ },
+
/**
* When the text input value has changed.
* @param {String} original text