Skip to Content
author's profile photo Former Member
Former Member

how to reset/refresh a View --- AGAIN

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

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

3 Answers

  • author's profile photo Former Member
    Former Member
    Posted on Feb 26, 2007 at 06:37 PM

    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...

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Feb 27, 2007 at 04:02 AM

    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

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Feb 27, 2007 at 04:20 AM

    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:

    get-the-current-view-in-a-non-static-method

    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.

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.