cancel
Showing results for 
Search instead for 
Did you mean: 

how to reset/refresh a View --- AGAIN

Former Member
0 Kudos

Hi

before posting this , i have read lots of similar posts in sdn but not able to implement - how to reset a view.

i hope someone can help me in this.

Scenario: I have a view in which i have got table with n number of rows, now if i select a row and click on a button to change the details of that row in a pop up window.

pop up window has a save button , when we click on this save button, the edited data gets saved and the pop up gets closed.

now i want the main view to refresh automatically when the pop up window was closed.

i have to write view.resetView in wdModify() but do i need some action to trigger this ??

how can i refresh the main view when the pop up was closed to see the updated data?

i hope to get perfect solution

thanks in advance

kaushik

Accepted Solutions (0)

Answers (3)

Answers (3)

pravesh_verma
Active Contributor
0 Kudos

Hi Kaushik,

Well, if you want to call the view.resetView() function of one view from another view then probably you have to implement the event handler which can intract betweeb you Pop-UP window and the mainview. I am writing down the main steps how to implement this, just customise this according to your project function and naming convention.

1) Go to the Component controller. Create a new EVENT, say <i><b>refreshView</b></i> and a Method say <i>refreshMainView()</i>.

2) In the Popup view go to the properties tab of the "View Editor" and add the add the component controller of your project.

3) In the Popup window as you said there is close popup function in that function call the method of the component controller.

To call the methos of controller:

wdThis.wdGet<Controller_Name>().setFinalValue();

4) Now in the controller code write this code in the refreshMainView method. This will call the event which you have created earlier.

public void refreshMainView( )  {
    //@@begin setFinalValue()
  	wdThis.wdFireEventRefreshView();
    //@@end
  }

5) In the Main window where you want to refresh the complete view create a Event Handler for this View.

Follow this path in the Methos tab of this Main view.

Methods-> New - >Event Handler-> Next -> Give name (say <i>refreshCurrentView</i>). Select the Event Source (ie: Name of the controller) and set the subscribed Event (ie: <b>refreshView</b>).

6) In the implementation finally write this code to refresh the view

public void refreshCurrentView(com.sap.tc.webdynpro.progmodel.api.IWDCustomEvent wdEvent )
  {
    //@@begin refreshCurrentView(ServerEvent)
          ...........  	
       
        // Call thev <b>view.restView</b> here in this function. 
        // Now whenever the close of the pop view will be called this function of the main view will be called 
        // which will actually refresh this Main view always on the trigger of this event handler.

          ...........  	
    //@@end
  }

[NOTE: To get the view object globally please look in to this thread, I have replied on this thread to get the view object for accessig through out the VIEW class:

I hope this will help you to solve your problem else feel free to revert back.

Regards,

Pravesh

PS: Please consider rewarding points if helpful and solved.

Former Member
0 Kudos

Hi Kaushik,

u r right in saying that view.resetView() is to be written in modify view method.

According to ur requirement,

1. u can create a button called Refresh and on click of that u can call modify view

as it is a public method. OR just click that button, because for each button click

modify view is called OR

2. u can define another global variable of type

com.sap.tc.webdynpro.progmodel.api.IWDView, suppose view1, and in modify

view, u can equate it to view.

And then in the action of Refresh button u can call resetView method for view1.

Hope it helps.

Regards,

Alka

Former Member
0 Kudos

You could execute the BAPI which reloads the table data (OR)

After the update in the popup window, write the code to reset the values of the node which is bound to the table...