Undoing JUST the a row delete

  • Thread starter Thread starter Mike Fox
  • Start date Start date
M

Mike Fox

I am trying to implement undo in an application. The problem is the user wants a granular undo like word or studio.

Here's the issue:
1. Bring up a record, and edit a field.
2. move to a new field and edit
3. delete the record
4. Now hit undo.

If I "undo" the delete using datarow.undo() or datarow.rejectchanges(), it reverts to the original state and I lose the changes fromstep 1 and 2. The user wants to be able to undo JUST the delete, and then udo the field changes with subsequent undo's if desired.

All I really want to do is set the row from rowstate=deleted back to rowstate=modified or unchanged. .net 2 has a setadded and setmodified, but these only work on rowstate=unchanged.

Anybody have any ideas how to handle this?


From http://www.developmentnow.com/g/36_0_0_0_0_0/dotnet-languages-csharp.ht

Posted via DevelopmentNow.com Group
http://www.developmentnow.com
 
"Mike Fox" <[email protected]> a écrit dans le message de (e-mail address removed)...

|I am trying to implement undo in an application. The problem is the user
wants a granular undo like word or studio.
|
| Here's the issue:
| 1. Bring up a record, and edit a field.
| 2. move to a new field and edit
| 3. delete the record
| 4. Now hit undo.
|
| If I "undo" the delete using datarow.undo() or datarow.rejectchanges(), it
reverts to the original state and I lose the changes fromstep 1 and 2. The
user wants to be able to undo JUST the delete, and then udo the field
changes with subsequent undo's if desired.
|
| All I really want to do is set the row from rowstate=deleted back to
rowstate=modified or unchanged. .net 2 has a setadded and setmodified, but
these only work on rowstate=unchanged.

Add the row to your own "deleted" list when marking it as deleted, and then
remove it after restoring the state back to modified.

Joanna
 
I implimented an undo function into one of my application by creating a
LIFO (last in, first out) collection of changes. You could store the
type of change it was (adding, removing, editing, etc), the unmodified
data ( like your datarow ), and then where the row was located. When
the user hits the 'undo' button you could call a function that take the
newest item from your undo collection and uses the information to undo
that change. This way the user could hit the Undo button multiple
times. Say your user wants to undo the edit he made right before
deleting that row; he could hit the 'undo' button twice and undo both
the delete and the edit. Just make sure you remove the undone item from
your collection or you'll end up undoing the same thing over and over.

This is just my two cents, though. :)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top