Skip to Content
avatar image
Former Member

Visible Property of lable in Webdynpro

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

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

3 Answers

  • Best Answer
    Jan 03, 2012 at 03:02 PM

    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

    Add comment
    10|10000 characters needed characters exceeded

  • Jan 03, 2012 at 03:03 PM

    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

    Add comment
    10|10000 characters needed characters exceeded

  • Jan 04, 2012 at 11:16 AM

    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

    Add comment
    10|10000 characters needed characters exceeded