cancel
Showing results for 
Search instead for 
Did you mean: 

Dynamically Adding View to ViewContainerUIElement

Former Member
0 Kudos

Hello Experts,

My application Consists of three views.

1. MAIN

2. View_1

3. View_2

MAIN view contains two buttons and one ViewContainerUIElement. I want to display View_1 in ViewContainerUIElement when user clicks on one button and View_2 when user clicks on another button.

My question is "Can we add or change the view dynamically in ViewContainerUIElement"? "

Any pointers??

Thanks,

Prashant

Accepted Solutions (1)

Accepted Solutions (1)

thomas_jung
Developer Advocate
Developer Advocate
0 Kudos

Generally the easiest way to place both views inside the View Container within the Window layout editor. Only one of the views will be the default view. If you need neither view dispalyed initially, you can also add the dummy EmptyView and make it the default view. You can then fire navigation plugs within the window to change change which view is the default.

http://www.flickr.com/photos/tjung/4545944354/

http://www.flickr.com/photos/tjung/4545944376/

http://www.flickr.com/photos/tjung/4545311117/

method handleshow_panel .
  case old_panel.
    when 'PANEL_DETAILS'.
      wd_this->fire_hide_panel_1_plg( ).
    when 'PANEL_SALES_ORDERS'.
      wd_this->fire_hide_panel_2_plg( ).
    when others.
      " Unknown panel
      assert 1 = 2.
  endcase.

  case panel.
    when 'PANEL_DETAILS'.
      wd_this->fire_show_panel_1_plg( ).
    when 'PANEL_SALES_ORDERS'.
      wd_this->fire_show_panel_2_plg( ).
    when others.
      " Unknown panel
      assert 1 = 2.
  endcase.
endmethod.

Former Member
0 Kudos

Hi Thomas,

Thank you very much for your valuable reply. Now my application behaving like

1. At the start of application INIT of main and then INIT of View 1 is called and view is displayed.

2. When user clicks on button 2 - then INIT of view 2 called and the same view is displayed

3. When user clicks on Button 1 - View 1 is displayed but INIT is not called second time as it was called when Main view is displayed initially.

4. When user clicks on Buton2 - View 2 sis displayed but INIT of view 2 is not called as it is called in step 2 .

My question is "It is possible to reload the view when user clicks on buttons from Main View. that means each time INIT method of the view (View displayed in ViewContainerUIElement ) should be called everytime"

Any pointers?

Thanks in Advance,

Prashant Jagdale

thomas_jung
Developer Advocate
Developer Advocate
0 Kudos

Yes you can do this. Go to the properties tab of the each View. There is a DDLB that controls the lifetime of the view. Change from the default Framework Controlled to When Visible. This will cause the View to be garbage collected as soon as it is no longer visibile in the Window and will result in the WDDOINIT being fired every time your return to the view.

This approach can be good or bad for performance depending upon your situation. Remember that data stored within the view will be freed, but will have to be repopulated. If you just need some logic to fire upon each view, consider using the inbound plug handler. However if you want to reduce memory consumption by destroying non-visible views, then this is an excellent approach.

Former Member
0 Kudos

Hi Thomas,

Thanks a lot for your help!!!!

One quick question, I saw all the links which given by you in above post. Which version of SAP you are using as in my version I am unable to see the pictorial representation of the views inside the window and navigation plugs between the view.

Thanks again for your pointers.

Thanks & Regards,

Prashant Jagdale

thomas_jung
Developer Advocate
Developer Advocate
0 Kudos

I'm using NetWeaver 7.0 Enhancement Package 2. The graphical window editor is one of the new features in 7.02.

Former Member
0 Kudos

Thanks...

Former Member
0 Kudos

Hi Thomas,

Is there any trial version or Sneak Preview available for this version? Could you please share download-able link with me?

Thanks in Advance,

Prashant Jagdale

thomas_jung
Developer Advocate
Developer Advocate
0 Kudos

See

The first ramp-up as part of SAP Project and Portfolio Management 5.0 just started. The Business Suite ramp-up starts in July. There won't be any trial version until General Availability at least.

Answers (0)