cancel
Showing results for 
Search instead for 
Did you mean: 

How to have & symbol in label text using SAPUI5

former_member393841
Participant
0 Kudos
1,497

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.

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

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.

former_member393841
Participant
0 Kudos

Hi Sharique,

Above code also have same problem no change in output screen.

Thanks

Harsha,

Former Member
0 Kudos

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

former_member393841
Participant
0 Kudos

Hi Pritin,

Thanks for replay,

Both solutions are not working for me, Can you suggest any alternative solution.

Former Member
0 Kudos

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