diff --git a/ChangeLog b/ChangeLog index 836658746..f218683f8 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,13 @@ +2010-08-03 Wolfgang Sourdeau + + * UI/WebServerResources/RowEditionController.js: + RowEditionController.startEditing: keep the "_selected" class + when starting edition, if exists. + RowEditionController.acceptEdition: revert the changes if the new + value is an empty string (might be wrong, though). + RowEditionController.onInputKeyDown: we now handle the tab key + too. + 2010-08-02 Wolfgang Sourdeau * UI/WebServerResources/RowEditionController.js: new class module diff --git a/UI/WebServerResources/RowEditionController.js b/UI/WebServerResources/RowEditionController.js index d6b5e084f..e6412dcb4 100644 --- a/UI/WebServerResources/RowEditionController.js +++ b/UI/WebServerResources/RowEditionController.js @@ -37,7 +37,12 @@ RowEditionController.prototype = { startEditing: function REC_startEditing() { var rowElement = this.rowElement; rowElement.previousClassName = rowElement.className; - rowElement.className = "editing"; + if (rowElement.className.indexOf("_selected") > -1) { + rowElement.className = "editing _selected"; + } + else { + rowElement.className = "editing"; + } var value = ""; for (var i = 0; i < rowElement.childNodes.length; i++) { @@ -92,11 +97,13 @@ RowEditionController.prototype = { acceptEdition: function REC_acceptEdition() { var newValue = this.textField.value; + var isValid = (newValue && newValue.length > 0); if (this.initialValue != newValue + && isValid && this.notifyNewValueCallback) { - this.notifyNewValueCallback(this, value); + this.notifyNewValueCallback(this, newValue); } - this.stopEditing(true); + this.stopEditing(isValid); }, cancelEdition: function REC_acceptEdition() { this.stopEditing(false); @@ -120,6 +127,9 @@ RowEditionController.prototype = { this.acceptEdition(); event.stop(); } + else if (event.keyCode == Event.KEY_TAB) { + this.acceptEdition(); + } }, onBodyMouseDown: function REC_onBodyMouseDown(event) { if (event.target != this.textField) {