cancel
Showing results for 
Search instead for 
Did you mean: 

Visible Property of lable in Webdynpro

Former Member
0 Kudos

Hi all,

I have a lable and a inputfield which are hide. I want that when a select something in my dropdownbykey, this two objects get visible.

How can i do that?

Regards,

Nirali

Accepted Solutions (1)

Accepted Solutions (1)

udaykumar_kanike
Active Contributor
0 Kudos

Hi Nirali,

Try creating a visibility simple data type with Boolean data type. Now assign this variable to the input field for visibility property. Then set the visibility manually using the following code.

wdContext.currentContextElement.setVisibility(Visible.<boolean data type>);

this code has to be written within the onAction event of dropdownbykey.

Hope it helps.

Regards

Uday

Answers (2)

Answers (2)

vijay_kumar49
Active Contributor
0 Kudos

Hi,

Please look this code

1.Create one Droupdownkey UI element in your firstView (Droupdown by key is bind to the one value attribute i.e MonthName)along this u can take 2 lable. For 2 lables you can set Visibility (com.sap.ide.webdynpro.uielementdefinitions.Visibility) property.

2. in wdinit() method you can write this code


ISimpleTypeModifiable myType=wdThis.wdGetAPI().getContext().getModifiableTypeOf("MonthName");  
IModifiableSimpleValueSet values =myType.getSVServices().getModifiableSimpleValueSet();
values.put("Vijay","Vijay");
values.put("Kalluri","Kalluri");  
wdContext.currentContextElement().setMonthName("Vijay");
wdContext.currentContextElement().setKalluri(WDVisibility.NONE);  
wdContext.currentContextElement().setVijay(WDVisibility.NONE);

3.in Droupdownby key having OnSelect event in that place you can create on method. Under method you can write this code.


String firstName = wdContext.currentContextElement().getMonthName();
wdComponentAPI.getMessageManager().reportSuccess("First Name:"+firstName);
String lastName = wdContext.currentContextElement().getMonthName();
wdComponentAPI.getMessageManager().reportSuccess("Last Name:"+lastName);
if(firstName.equalsIgnoreCase("Vijay"))
{
wdContext.currentContextElement().setKalluri(WDVisibility.VISIBLE);  
wdContext.currentContextElement().setVijay(WDVisibility.NONE);
 }
else
{
wdContext.currentContextElement().setVijay(WDVisibility.VISIBLE);
wdContext.currentContextElement().setKalluri(WDVisibility.NONE);
}

Hope this helps u.

Best Regards

Vijay K

Edited by: VijaySAPEP on Jan 4, 2012 4:47 PM

Edited by: VijaySAPEP on Jan 4, 2012 7:32 PM

Former Member
0 Kudos

Hi experts,

I solved my problem by creating all the things you all told me.

I also found this tutorial that seems to be what i was looking for: http://wiki.sdn.sap.com/wiki/display/WDABAP/SetvisibilityofbuttondynamicallyinWebDnproABAP

Thanks to help me solve out the problem.

Regards,

Nirali

Qualiture
Active Contributor
0 Kudos

1) Bind the 'visible' property of both the label and the input field to a context attribute of type com.sap.ide.webdynpro.uielementdefinitions.Visibility

2) In the event handler of the onSelect of your dropdown, evaluate the value of your dropdown. Based on the selection, set the context attribute to either WDVisibility.VISIBLE or WDVisibility.NONE