cancel
Showing results for 
Search instead for 
Did you mean: 

Method call instead of context binding for UI attribute

daniel_humberg
Contributor
0 Kudos

Hi,

I have a link that opens an external URL.

Furthremore, I have a context node with the URL for the link.

I have bound the context node to both the reference, and the text attribute of the link.

Now I would like to cut-off the link-text if the URL is longer that 30 characters and add 3 dots ("..."). So the link should look like this

<b><u>http://www.sap.com/blablabla.ht...</u></b>

For this, I have a method GET_SHORTENED_URL.

Do I need a new context element that stores the shortened URL? And where do I call the method to shorten the URL?

PS: I have similar problems frequently, where I want to modify some attributes of some UI elements with some methods (usually, read-only attributes like the "text" of a link). Do I need a context attributes for all these values?

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi Daniel,

Yes, you need a different attribute to store the text of the URL, and bind that attribute to the text property, and you will be binding the long url to the reference property. When you call the method get_shortened_url, do a set_attribute to set the text property.

Regards

Nithya

daniel_humberg
Contributor
0 Kudos

Hi Koen,

neither the context element not the link have a width.What did you mean?

Hi Nithya,

what's the best place to call that method "GET_SHORTENED_URL" ?

In WDDOMODIFYVIEW ?

Regards,

D.

Former Member
0 Kudos

Hi,

you can set your column width of the container element as well to your preferred length,

make sure there's no wrapping and this way the text should be smaller

grtz,

Koen

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi,

if you change the width of the context elements, the content gets truncated

grtz,

Koen