on 04-23-2010 2:10 PM
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
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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
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.
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
User | Count |
---|---|
93 | |
10 | |
10 | |
9 | |
9 | |
7 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.