Opened 15 years ago

Closed 14 years ago

Last modified 13 years ago

#505 closed enhancement (fixed)

I can't undo change when the newValue is not correct.(dojo.widget.InlineEditBox)

Reported by: [email protected] 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 14 years ago by dylan

Milestone: 0.4
Owner: changed from anonymous to dylan
Status: newassigned

comment:2 Changed 14 years ago by dylan

Owner: changed from dylan to tk
Status: assignednew

comment:3 Changed 14 years ago by Karl Tiedt

Resolution: fixed
Status: newclosed

(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.

comment:4 Changed 14 years ago by tk

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)

comment:5 Changed 13 years ago by (none)

Milestone: 0.4

Milestone 0.4 deleted

Note: See TracTickets for help on using tickets.