cancel
Showing results for 
Search instead for 
Did you mean: 

Visibility issue

Former Member
0 Kudos

Hi,

I want to give the visibilityt to the text field depending on the calculated value that is obtained when a button is pressed.

Can anyone please help.

Thanks,

Anu

Accepted Solutions (0)

Answers (3)

Answers (3)

gill367
Active Contributor
0 Kudos

Hello,

create a new context attribute of type visiblity.

bind the visiblity of the text field to this attribute.

Make this attribute calculated.

in the getter method of the attribute, write the logic to check the desired case.

For example you have one context attribute named Len.

we set its value to abc in the action handler of the button.

Then you can check the value of this context attribute in the getter method to set the value of visibility.

As shown in the following code.

  if( element.getLen().equalsIgnoreCase("abc"))
   {
   	return WDVisibility.NONE;
   	
   }
   else
   
   return WDVisibility.VISIBLE;

thanks

Sarb

p330068
Active Contributor
0 Kudos

Hi Anuradha,

You can use context attribute with properties type : com.sap.ide.webdynpro.uielementdefinitions.Visibility

Bind context attribute to your text field.

On you Button Action Please loop.

If Loop on your calculated value :

For Visisble : wdContext.currentContextElement().setTes(WDVisibility.VISIBLE);

For Not Visisble: wdContext.currentContextElement().setTes(WDVisibility.NONE);

Hope that will resolve your issue.

Thanks

Arun

Former Member
0 Kudos

Hello Anu,

Create a context attribute say "messageVisibility"

By default, the attribute type is string. You have to change this to "com.sap.ide.webdynpro.uielementdefinitions.Visibility"

com.sap.tc.webdynpro.progmodel.api.WDVisibility

To do this,

1. click on the browse button adjacent to visibility property

2. select Dictionary simple type

3. browse for and select com.sap.ide.webdynpro.uielementdefinitions.Visibility

Now, set "messageVisibility", content attribute created previously to value of visibility property.

bind the context element messageVisibility to visbile property of ui element.

You have to set appropriate value for attribute in INIT method WDVisibility.VISIBLE or which ever suites your needs.

Best regards,

Nrisimhanadh Yandamuri

Former Member
0 Kudos

> I want to give the visibilityt to the text field depending on the calculated value that is obtained when a button is pressed.

create a calculated Context Element of type WDVisibility found under "predefinedui".

receive the value from the button (element.getXXX()) and return Visible or Invisible (return buttonCode == true ? WDVisibility.VISIBLE : WDVisibility.NONE;

then bind that value to the visible property in your view element.

jan