cancel
Showing results for 
Search instead for 
Did you mean: 

Passing parameters to ViewContainer

Former Member
0 Kudos

a)

I have a view container element that I want to pass parameters to. Is there a way to transcationally do this?

Can someone post some sample code.

b) To solve the above problem I fired a plug to the view inside the view container. This seems to create another thread and leads to unpredictable results. (The parent view renders correctly in some cases and doesn't in some other cases). Is this the wrong approach to passing parameters to viewcontainers? what is the recommended way.

Any help is appreciated..

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi

What parameters are you trying to pass to the View Container. Can you explain a bit more on that.

regards

ravi

Former Member
0 Kudos

Let me rephrase the question.

(Can I) How do I access/set the context variables inside the embedded view from the parent view?

thanks,

rakshit

Former Member
0 Kudos

Hi

Are both the views in the same component or are you using 2 different components , one for Parent and one for child.

If it is a single component then you can access the context variables by using context mapping between the parentview and the component controller and then from component controller to the embedded view.

For test purpose just create a View1 with a input field and bind it to a context attribute of type say string.

Create a View container ui element and add it to another view called View2.

Now define the inbound and outbound plugs.

Create context attribute say va_str1 in View1.

Create a context attribute say va_componentStr1 in the component controller.

create a context attribute say va_str2 in View2.

Do a context mapping from View1 to component controller and then from component controller to the View2.

On click of some action in View1 just fire the plug.

In the View2 init() just write a print message

wdComponentAPI.getMessageManager().reportSuccess("Value "+wdContext.currentContextElement().getva_Str2());

I havent tried it with different DC's but do let me know if this was helpful.

regards

ravi

Former Member
0 Kudos

Solved my problem.

thanks

Answers (0)