cancel
Showing results for 
Search instead for 
Did you mean: 

Cancel functionality in popup

Former Member
0 Kudos

Hello,

I am having trouble figuring out how to cancel changes made to a record in a popup window. Here's the scenario:

- Main window has a table showing records from a user table.

- At bottom are several buttons. Two of them (Add, Edit) bring up a popup window.

- When the popup is opened as a result of the Edit button being clicked it shows the content of the selected row from the table.

- The popup has two buttons: OK & Cancel.

- The OK button should close the popup and automatically "update" the Main window's selected row.

- The Cancel button should "undo" all changes made to record and then close the popup.

I've gotten everything but the last part to work. When the Edit button on the Main window is clicked I bind the selected entry to a context element and the bind that element to the popup window. I'll be glad to provide the code if that'll help someone give me an answer.

If I click OK on the popup it just closes the window and the changes automatically are displayed in the selected row.

One option I thought of was to just save the original row element somewhere and then revert to it if Cancel is clicked. HOwever, before I go down that road I wondered if there was some built-in functionality I can take advantage of or if there was a recommended way of handling this issue.

Thanks in advance for any help.

David.

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi ,

Only thing i see here is there should not be ant contextmapping btn "Users" node and "affectedUsers" node.

Regards, Anilkumar

Former Member
0 Kudos

Anilkumar,

There isn't. The mapping is between the "SelectedUser" controller context node and the "AffectedUser" view context node.

Looks like my solution will have to be to save the "AffectedUser" view context node as soon as the popup view is initialized. Then if the Cancel button is clicked the event handler will need to replace the view context node object with the saved object.

Thanks for your help.

Answers (3)

Answers (3)

Former Member
0 Kudos

I mean use different context in popup view with the same attribute syructure.Do not apply any context mapping.

Regards, Anilkumar

Former Member
0 Kudos

Anilkumar,

Sorry to be so dense but I think I need further clarification. Please remember that I'm still very much of a newbie to Web DynPro.

Here is the current scenario.

- The Main view displays a table of users.

- The AddChangeUsers view displays detail information about a specific user.

- The table on Main view is bound to a component context node called “Users”.

- The individual fields on the AddChangeUsers view are bound to the elements of a view context node called “AffectedUser”.

- When the update button on the Main view is clicked, the event handler sets another component context node (called “SelectedUsers”) to the appropriate row out of “Users”.

- The component context node “SelectedUsers” is context mapped to the view context node “AffectedUser”.

Are you saying I should NOT be doing it this way? If so, can you suggest a better way?

Would it help if I included code?

FYI - All of these context nodes are based on a model called "User". The Users node is actually a collection of User objects.

Thanks again for your help.

David.

Former Member
0 Kudos

Hi David,

Please don't do the contextmapping btwn the view and popup and use seperate context for the popup.

This is may not be perfect solution for this problem but this should solve the problem !!!

Regards, Anilkumar

Former Member
0 Kudos

Anilkumar,

I'm confused by your reply.

At first you seem to be telling me NOT to do the context mapping but then you seem to be saying it should solve the problem.

Could you please elaborate?

David.

Former Member
0 Kudos

Hi David,

I guess, you have mapped your view context to the popup window's view context. And you are displaying the data in popup. Now, when you change data in popup it will also affect in original view where your table is.

But, on cancel event you want to do revert to original data, Right.

For this, you have to store that data seperately, and on action of cancel you have to set that data back. There is no standard or built-in facility for that.

Regards,

Bhavik

Former Member
0 Kudos

Bhavik,

You guess right. That is exactly the situation. Sorry to hear that there is no built-in functionality for that.

Thanks for your reply.

David.