cancel
Showing results for 
Search instead for 
Did you mean: 

How to disable/enable image property in Web Dynpro?

former_member184029
Participant
0 Kudos

Hi,

I was trying to find a help about "How to disable/enable property of an image in Web Dynpro?" but never find it. Let me explain what I'm trying to do:

I need to show three different status (Released, Rejected and Approved) each one is an image ... <b>How do I do to disable images property before a process and enable them after it?</b>

Thanks in Advance, and waiting an answer As Soon As Possible !!!

Tokio

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

Your question is not completely clear to me. An image cannot trigger an event, so disabling it has no effect.

To display different images in a Image element depending on some condition, you can use a calculated context attribute <i>imageSource </i>of type "string" that returns the URL of the image, something like

public String getImageSource(IWDNodeElement element)
{
  if (...)
  {
    return "image_for_status1";
  }
  else if (...)
  {
    return "image_for_status2";
  }
  else if (...)
  {
    return "image_for_status3";
  }
  return ""; /* no image will appear */
}

Bind property Image.<i>source </i>to attribute <i>imageSource</i>.

If you put the three image files inside folder src/mimes/components/<componentName>, your method can simply return the file name without calculating an URL.

Armin

former_member182374
Active Contributor
0 Kudos

Do you mean Visibility?

If yes, you can create in the context a value attribute of type visibility and change the visibility to NONE/VISIBLE according to your program's needs.

To create a value attribute of type visibility:

1) Create a new value attribute

2) Go to the "type" property and click "..."

3) Select "com.sap.ide.webdynpro.uielementdefinitions"

4) Select "Visibility"

Omri

former_member184029
Participant
0 Kudos

Well, that's mean if I have a image and I change the property Visible to NONE, it won't appear?

Tokio

former_member182374
Active Contributor
0 Kudos

Yes, the image will disappear.

After you create the value attribute in the context you bind it to the visibility property of the image and then you can change it by code.

For example:

wdContext.currentContextElement().set<<varName>>(WDVisibility.VISIBLE);

former_member184029
Participant
0 Kudos

I will test your advice and let you know.

Thank you to all of you!!!

Tokio