cancel
Showing results for 
Search instead for 
Did you mean: 

Managing "isDirty" flag

Former Member
0 Kudos

I have a view split into two separate parts: a tree on the left and a details form on the right for the selected element in the tree (there is actually more than one details form because there are different forms for the different levels in the tree). I would like the details forms to be directly editable (not using an edit button to pop up a modal version of the forms), but I am not sure how to handle the management of an "isDirty" flag.

Is there a way I can manage the "isDirty" state of the current record solely in the details forms? I want to do it this way so I don't have to map the "isDirty" flag to the other views on the window and check it at the beginning of every action that would cause the user to lose any "dirty" data from the details forms. I can see this getting very nasty very quickly as I would have to set up event handlers for yes/no/cancel (for the save confirmation prompt before losing "dirty" data) for pretty much each type of action. I say each type of action because I would have to differentiate between save and continue (for "yes" in the confirmation dialog) for "Go back to start page" and save and continue for selecting a different node in the tree (and so forth).

It seems like it would be much easier to manage the "isDirty" flag solely on the details forms so that I don't have to worry about what action caused the prompt. Maybe there is a better way entirely... because even this seems overly complicated. Any ideas?

Thanks,

-Dave

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

David,

If you are using not just plain context nodes but model node that implements com.sap.tc.cmi.util.ICMIModificationCount then you can track modifications easily: just save modCount on enter and read it again on exit, if delta differs from zero then model object was modified.

For example, Dynamic RFC model classes implements this interface

VS

Former Member
0 Kudos

I'm able to detect whether or not the data is dirty with no problems... It's just that the other view that is displayed at the same time is a tree (with a lot of actions that can cause the details record to change). Right now, it's looking like I am going to have to check whether the currently displayed detail record is dirty at the beginning of all those actions, and provide the ability to save and perform the action, don't save and perform the action, or don't save and don't perform the action (yes, no, cancel on a "do you wish to save" confirmation dialog). This will get really nasty really quick and I am looking for a better way to do it.

Any ideas would be greatly appreciated...

-Dave

Former Member
0 Kudos

Hi David

Are you planning to integrate your application in the portal. If you are then you can use the WorkProtectMode.

Take a look at the WDPortalWorkProtectMode class. Maybe that could be of help.

regards

Ravi