cancel
Showing results for 
Search instead for 
Did you mean: 

How to control visibility of one component from the another component.

Former Member
0 Kudos

Hi,

I have a text in a view of a component and two radiobutton (grouped by Key used simple type) in another component.I have to set the visibility of the text as Visible and None depending upon the selected radiobutton. I have passed the visibility context from the component to other component having radio button using interface controller and tried setting the visibility using the following Code, but the text of another component is constantly visible irrispective of the Radiobutton selected.

String radBtn = wdContext.currentCtx_vn_RadioNodeElement().getCtx_va_EmailAlert();

* *

* if(radBtn.equalsIgnoreCase("yes"))*

* {*

* *

* wdContext.currentContextElement().setCtx_va_APEmail(WDVisibility.VISIBLE);*

* }*

* else if(radBtn.equalsIgnoreCase("no"))*

* {*

* wdContext.currentContextElement().setCtx_va_APEmail(WDVisibility.NONE);*

* *

* }*

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi Sikha,

You can't pass the parameter like this from one application to other application because the values can't be retained in the interface view and can't be change dynamically specially for this scenario, For this you have to crate a method in first application where the radButton exist, that method should return the value of red button and from the second application where you want to make a button visible or invisible you have to call this method and based on the return value you have to set the visibility of related attribute. It will work perfectly. Let us know if you need any more assistance on this.

Regards

Jeetendra

Former Member
0 Kudos

Hi Jeetendra,

Thanks a lot for clarifying my doubt.

I have checked by printing the value in interface controller, the values ar actuaaly not retained.

I tried implementing solution given by you and i need your help.Please let me know how can i call method of one component to other.The methods are not visible in other component i can see only events and eventhandlers visible in other component.

Thanks

Shikha Singh

Former Member
0 Kudos

Hi Sikha,

For that first you need to expose the component as public part right click on component controller and click on add to public part and then build the DC.

Once the DC is build go to second application and right click on dc and click on development component>show in>component property.

then go to dependency tab and click on add dependency. Select the previously exposed public part. once the dependency is added build the second application.

then go to component controller's java editator go to that method where you want to access the value of that boolean field and call the method by following syntax


boolean var = wdThis.wdGet<UsedComponentControllerInterface>.<method>;

remember that the method which you are accessing from component 1 should be available in that components interface.

Regards

Jeetendra

Former Member
0 Kudos

Hi Jeetendra,

I have tried out several ways.

as interface controller is called first in sequence,I am not able to check radiobutton click.

I have called a method of component contoller on click of "yes" which returned true and on click of no called another method which returns false,and in interface controller i am checking the returned values,but whatever code is written in interface controller is executed without executing the code in component controller(irrespective of what values is returned from conponrnt controller).It takes default values for boolean flag. I have even tried returning string, it takes "yes" irrespective of what radio button is selected.

Please help me out

Thanks

Shikha

Answers (5)

Answers (5)

Former Member
0 Kudos

Hi Sikha,

You should check folowing ponits once again:

1) Check the simple type mainly the Enumeration tab and type.

2) Check whether the radio buttons are made type of the simple type or not.

3) Print which value you are getting in the runtime in "radBtn".

4) Check mapping for the getCtx_va_EmailAlert field if it is mapped with controller.

5) Don't confuse with two redio buttons.Check configuration for the both.

6) Check the TEXT field visibility binded properly with Ctx_va_APEmail attribute.

7) Use messege printing for each step to analyze the values in run time.

Hope this will help.

Thanks,

Sukalyan

p330068
Active Contributor
0 Kudos

Hi Shikha

Please check and print the values for the radBtn and then make the modification accordingly. Also verify with putting print message to check control going if/else statement or not.

Regards

Arun Jaiswal

Former Member
0 Kudos

Hi,

Are you sure that the values("yes" and "no") which you are trying to compare are the key for the simpleType and not the values. Also try to print the value for radBtn.

Regards,

Manoj

former_member214651
Active Contributor
0 Kudos

Hi,

Have you maintained the key values as "yes" and "no" in the enumeration tab of the simple type created?

Regards,

Poojith MV

junwu
Active Contributor
0 Kudos

Hi,

have you printed the radBtn?what's the value?

i think you can use event to achieve your requirement.

when radio button is selected, it raises a event with some parameter, which is subscribed by the other component.

Best regards,

John

Former Member
0 Kudos

Hi Shikha,

Did u check if there is any visibility context binding already exists for that 'TEXT' , may be that is overwriting the changes you made to this text visibility.

Regards

Lavanya