cancel
Showing results for 
Search instead for 
Did you mean: 

How to change default view programatically

lajitha_menon
Contributor
0 Kudos

Hi there,

I have 2 views in one window, and one application. when this application is called, depending on a value which is calculated based on a url based parameter, the default startup view should change. So, the screen that is displayed to the user should change depending on the calculated value. I can give one view as default and navigate to the next one, in the wdDoInit method. But in the init method, I dont have the variable value, as the view is initialised before the variable receives its value. I have the value available in wdDoModifyView, however, I cannot navigate to any other view from this method bypassing current view.

How can I achieve the functionality required?

Thanks,

LM

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

The window has a default inbound plug with a corresponding method onPlugDefault(). There you could check the value and navigate correspondingly.

Armin

lajitha_menon
Contributor
0 Kudos

Hi Armin,

Thanks for the quick response. I can get into the code of the plug, But How do I navigate to a view from here?

I know it must be something simple, just cant make out how to go about doing it.

cheers,

LM

Former Member
0 Kudos

You must define navigational links to the target views. Then there will be corresponding methods to navigate.

Armin

lajitha_menon
Contributor
0 Kudos

Hi Armin,

The navigational links are built in corresponding window. But the code to navigate is only available from within a view. Not in the interface view controller, where the onPlugDefault code is there. The only navigational code available to me in the interface view controller are the outbound plugs defined for the interface view(exit plug for example).

But what I want is precisely a the code with which I am able to navigate to a view in the window.

Any ideas?

Cheers

LM

Former Member
0 Kudos

Hi,

U can write the code for navigating to the iview u desired in the component controller init() method.

This is being called first if u execute an application.

Regards,

Nagarajan.

lajitha_menon
Contributor
0 Kudos

Hi Nagarajan,

Thanks for the answer.

Is the code to be written in the comp. contr. to call the window with window.open() ?

or did you mean something like wdFirePlug..

Can you clarify?

Thanks

Lm

Former Member
0 Kudos

Hi,

I meant the fire plug code.

Sorry I haven't tested this scenario, but just try out this code.

In the interface view create two outbound plugs.

one for first view and another for second view.

In the component controller properties tab add the Interface view.

Inside init() method call the iview u wish according to the condition,

wdThis.wdGet<Interface view controller>().wdFirePlug<outbound plug name>();

Hope it helps,

Regards,

Nagarajan.

Message was edited by: Nagarajan Kumarappan

Message was edited by: Nagarajan Kumarappan

Former Member
0 Kudos

Ok.

First, define a parameter "targetView", type "string, for the default inbound plug: method onPlugDefault() will automatically get this parameter and the value at runtime will be the value of the URL parameter.

Define a controller usage from the window controller to the component controller.

Add a method navigate(String targetView) to the component controller.

Add a (controller) event "Navigate" to the component controller and subscribe to this event from the view controller.

The processing sequence is then:

Default inbound plug of window:

onPlugDefault(IWDCustomEvent wdEvent, String targetView)
{
  /* call component controller method */
  wdThis.wdGet<ComponentController>().navigate(targetView);
}

Component controller:

void navigate(String targetView)
{
  /* fire the "Navigate" event */
  wdThis.wdFireEventNavigate(targetView);
}

Subscribed view controller:

void onNavigate(IWDCustomEvent wdEvent, String targetView)
{
  /* call appropriate outbound plug */
  ...
}

Armin

lajitha_menon
Contributor
0 Kudos

Armin,

Star!!!

Thanks a lot,

LM

0 Kudos

Hello,

in the InterfaceView where the onPlugDefault Method is, I cannot select the wdThis.wdGet<Component>() Component-Controller nor the wdThis.wdGet<Component>InterfaceController() InterfaceController - only wdThis.wdGetAPI() is available.

Why?

PS: Access to the parameter through WDWebContextAdapter works fine.

Best regards,

Manuel Schaffner

Former Member
0 Kudos

Hi,

Where your using that simple double click on(if u are using the view) that and goto the properties add that interfaceView to your current then That will come to ur coding.

Now avail this.

wdThis.wdGet<Component>InterfaceController() InterfaceController

Thanks,

Lohi.

Answers (0)