cancel
Showing results for 
Search instead for 
Did you mean: 

Unable to pass data from one view to another

Former Member
0 Kudos

Hi.

Im unable to pass data from one view to another.

Scenario.

I have a view1 and view2 with attribute isTrue in each of the view.

I mapped the attributes of both the view to component controller (comp1).

view1->comp1<-view2

I have a button in my view1. In the button event, I'm writting the following code.

wdContext.currentContextElement().setisTrue(true);

Obvioulsy Im firing the plug to show the view2, In view 2 Im doing some calculation by checking a condition if the attribute isTrue value is true.

But only default value come as false always.

When I debug the component I noticed that the value is not passed to component controller itself.

I was doing the sameway coding for many components and its working, Im puzzled why this simple task is not working for me.

Note: I tried with changing attributes type as string and passed the values, then too this is not working. I tried in CustomController too, then also the same problem occurs.

Can anyone give me suggestions?

Regards

Bala

Message was edited by:

Balachandar P

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi,

Define the VA in Comp1 and register the Comp1 to View1 and View2 and context mapping Add it to View1 and View2.

In the first view Init method that VA set to True then it will be coming to View2

WdContext.currentContextElement().SetVA(True);

U can display the this attribute in second View like this.

wdThis.GetcomponentAPI().getMessageManager().reportSuccesss(VA);

Thanks,

Lohi.

Former Member
0 Kudos

Hi Lohitha.

That too does'nt works for me.

I doubt whether the roblem is with my NWDS .

Regards

Bala

Former Member
0 Kudos

Hi,

This Stranage try to declare simple string in controller and map to two views and set the data in the first view and dispaly in second.

Try this.

Thanks,

Lohi.

Former Member
0 Kudos

Hmm.. Thats a strange problem. Create a plug parameter of type boolean and use it to pass data between views.

Its quite strange that mapping is not working.

Regards

Bharathwaj

Former Member
0 Kudos

Hi Lohitha.

Thanks for your reply.

As I mentioned above (Note) in the question, I tried for strings too.

Regards

Bala

Former Member
0 Kudos

Hi Bharath.

That is my final solution to pass the value as plug parameter, if this mapping does'nt help me out.

Regards

Bala

Former Member
0 Kudos

Hi all.

Finally I pass the value through plug to another view.

But the mapping issue still continues.

Regards

Bala

Answers (3)

Answers (3)

Former Member
0 Kudos

Hi Balachandar,

Check the value that you are setting in the View1 itself.

wdContext.currentContextElement().setisTrue(true);

Now print the value and check it in the same view.

wdComponentAPI.getMessageManager().reportSuccess(""+wdContext.currentContextElement().getisTrue());

If you are still facing the same pblm then close the project or close the studio and then try it out.Final option is to restart the server.

Regards,

Jhansi

Former Member
0 Kudos

Hi Bala,

Do you perhaps have the calculated property set to true in your component context? If so, this wil overwrite the boolean you set in your view...

Kind regards,

J.

Former Member
0 Kudos

Hi Joren.

The calculated property of the attribute is false.

Regards

Bala

Former Member
0 Kudos

do you have dynamic mapping?

do you reset your mapping?

Former Member
0 Kudos

Hi Peter.

No, Im not doing a dynamic or reseting the mapping

Regards

Bala

monalisa_biswal
Contributor
0 Kudos

One more option is to set value directly using reference of component controller in view1 and in the same way access value in view2.

wdThis.wdGet<Controller Name>Controller().wdGetContext().currentContextElement().set<attribute>();

If it works that means there is some error in context mapping.

Former Member
0 Kudos

Hi Bala,

I suggest you to check the mapping once again.

View1 context mapped to ComponentController.

ComponentController to View2.

Check the readonly property of the attribute "isTrue" once.

Regards,ANilkumar

Former Member
0 Kudos

Hi Anil.

Mapping is done perfectly from view1->comp1<- view2.

readonly property is false for all the attribute in both view and controller

Regards

Bala