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

Dynamic Views depending on URL parameters

Hi Experts,

I have to dynamically render a view to a view container depending upon the url parameters at start-up.

If the url parameter is 'E' then the ESS version of screen should appear and if an 'M' is passed it should show the view for the MSS version.

For this I have created 1 main View which contains a 'View Container', and 2 Views as the ESS and MSS screen. I have embedded views and defined plugs accordingly.

But the problem lies in the fact that the Window's 'Startup event handler' is called after the initiation of the View and Window Controllers, hence I am not getting the a place read the url parameter before that, and thus I cannot dynamically decide which view to embed to the container( fire the correct outbound plug) at start up.

Please suggest, as how I can get the url parameters beforehand and decide which view to embed to the View Container at startup.

Thanks

Akashdeep

Add a comment
10|10000 characters needed characters exceeded

Related questions

3 Answers

  • author's profile photo Former Member
    Former Member
    Posted on Mar 15, 2011 at 06:02 PM

    You can access URL parameters anywhere in the code using the following:

    data lv_your_variable type string.

    lv_your_variable = cl_wd_runtime_services=>get_url_parameter( name = 'YOUR_URL_PARAMETER' ).

    case lv_your_variable.

    when 'E'.

    fire_plug 1

    when 'M'.

    fire_plug 2

    You need not rely on the hook method. I suggest perhaps the wddoinit method if it makes sense.

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Mar 15, 2011 at 08:23 PM

    Hi,

    What i would do is in addition to what you already have, create a new view V-Channel and embed this view as default view in the Window.

    Create 2 outbound plugs (to_view1 , to_view2)

    Create a event in component controller like event_name is NAVIGATE and the parameter is TO of type string.

    Create a method go_navigation with parameter destination of type string.

    Write your code in this method to fire the Navigation event filling the TO parameter with destination.

    In the V_Channel subscribe to this event NAVIGATE. and write the code for firing outbound plug to_view1 or to_view2 based on the TO parameter value.

    Remember to connect these outbound plugs to the right inbound plugs in the ViweContainerUIElement views.

    In the start-up plug event handler method, retrieve the URL parameters and call the Go_NAvigation method filling the right value for the destination parameter.

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Dec 13, 2011 at 05:57 AM

    Thanks guys for Your answers

    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.