#505 closed enhancement (fixed)
I can't undo change when the newValue is not correct.(dojo.widget.InlineEditBox)
Reported by: | Owned by: | tk | |
---|---|---|---|
Priority: | high | Milestone: | |
Component: | Widgets | Version: | 0.2 |
Keywords: | Cc: | [email protected]…, [email protected]… | |
Blocked By: | Blocking: |
Description
when i use dojo.widget.InlineEditBox?,I want undo change in onSave() when the "newValue" is not correct. but i can't.
saveEdit: function(e){ e.preventDefault(); e.stopPropagation(); var ee = this[this.mode.toLowerCase()]; if((this.textValue != ee.value)&& (dojo.string.trim(ee.value) != "")){ this.doFade = true; this.history.push(this.textValue); this.onSave(ee.value, this.textValue); //invoke undo() in onSave() can't do anything!!! this.textValue = ee.value; this.editable.innerHTML = this.textValue; }else{ this.doFade = false; } this.finishEdit(e); }
maybe it should be like this:
var oldValue = this.textValue; var newValue = ee.value; this.textValue = newValue; this.editable.innerHTML = newValue; this.onSave(newValue, oldValue); //invoke undo() in onSave() can make editable.innerHTML be the oldValue
Change History (5)
comment:1 Changed 16 years ago by
Milestone: | → 0.4 |
---|---|
Owner: | changed from anonymous to dylan |
Status: | new → assigned |
comment:2 Changed 16 years ago by
Owner: | changed from dylan to tk |
---|---|
Status: | assigned → new |
comment:3 Changed 16 years ago by
Resolution: | → fixed |
---|---|
Status: | new → closed |
comment:4 Changed 16 years ago by
Cc: | [email protected]… [email protected]… added |
---|
Just for reference:
this.undo() now calls this.onSave() just like SaveEdit?() does, thus giving you an opportunity to resave your old data.
Also include the Name of the input area as an argument to onSave now as well.
-Karl
(this is mainly so I know the submitter gets notified of this ticket change)
Note: See
TracTickets for help on using
tickets.
(In [5789]) Fixes #505 onSave now passes newValue, oldValue, this.name so saveHandlers can pass data as if it was from a form, and added call to this.onSave() from this.Undo() to give saveHandlers an opportunity to undo changes as well.