471,325 Members | 1,539 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,325 software developers and data experts.

Undoing JUST the a row delete

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...ges-csharp.htm

Posted via DevelopmentNow.com Groups
http://www.developmentnow.com
Jan 6 '06 #1
2 2880
"Mike Fox" <no****@developmentnow.com> a écrit dans le message de news:
f9**********************************...icros oft.com...

|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

--
Joanna Carter [TeamB]
Consultant Software Engineer
Jan 6 '06 #2
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. :)

Jan 6 '06 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

3 posts views Thread by Nimmi Srivastav | last post: by
11 posts views Thread by DamonChong | last post: by
2 posts views Thread by Dave | last post: by
3 posts views Thread by silver360 | last post: by
reply views Thread by rosydwin | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.