Skip to Content

How to have & symbol in label text using SAPUI5

Hi all,

I have an issue with & symbol printing when i use & in between text it displaying as &

For ref pls see below screen shot.

I am using below code

var oStep5 = new sap.ui.commons.RoadMapStep("step5", {label: "Compliance & Contract Documents"});

Thanks in advance.

Harsha.

Capture22.JPG (9.4 kB)
Add comment
10|10000 characters needed characters exceeded

2 Answers

  • author's profile photo Former Member
    Former Member
    Posted on Aug 22, 2013 at 06:13 AM

    Looks like this is only happening after the label text exceeds a certain length. I feel this is definitely a bug.

    To not let it stop your work, you could just use jQuery as a hack, but you will need to take care to execute this jQuery code every time your RoadMap is rendered/re-rendered, and also to ensure that the code is executed only after the RoadMap has actually rendered. (for example, assuming that you're creating the RoadMap in your createContent() function, the snippet won't work before createContent() has returned)

    $(".sapUiRoadMapTitle").each(function(i, title){      $(title).html($(title).html().replace("&","&")); });

    Update

    Just stumbled across a CSS3 "text-replace" property that I didn't know existed! This would be a better alternative to the above solution.

    Please have a look at http://www.cssportal.com/css-properties/text-replace.htm

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member Harsha pagadala

      Hi Harsha,

      I have tested the jQuery version and it works. Are you creating the RoadMap in the createContent() function of your view?

      If so, try putting the above jQuery snippet within

      window.setTimeout(function() {//jQuery snippet}, 0);

      ... inside createContent.

      If this doesn't work, do share more information on how/where you are creating the RoadMap, and where in your code, you used the jQuery snippet

  • author's profile photo Former Member
    Former Member
    Posted on Aug 22, 2013 at 08:14 AM

    Hi Harsha, what you can do for now is something like this,

    var oStep5 = new sap.ui.commons.RoadMapStep("step5", {label: "Compliance" + " & " + " Contract Documents"});

    I hope this will help.

    Add comment
    10|10000 characters needed characters exceeded