cancel
Showing results for 
Search instead for 
Did you mean: 

How to make some text in text area bold?

0 Kudos

Hi All,

Following is the code I used to make some part of text in text area Bold.

new sap.ui.commons.TextArea({

    cols : 43,

  rows : 4,

  visible : true,

  enabled : false,

  value: { parts:[

              {path: 'uidata>loggedInUserName'},

              {path: 'uidata>commentDate'},

              {path: 'uidata>loggedInUserComments'}

                ],

     formatter: function(caseId,custNo,title) {

      var boldc=caseId.bold();

         return boldc+" --- "+custNo.bold()+"\n"+title;

         return caseId+" --- "+custNo+"\n\n"+title;

      }

  },

  })

It didn't work. Can anyone help?

Thanks in advance

Accepted Solutions (1)

Accepted Solutions (1)

saivellanki
Active Contributor
0 Kudos

Hi Sudarshan,

Actually, you can place only text content inside a TextArea and you cannot place HTML tags.

You were using .bold() method which returns the text in the following format:


<b>Some Text</b>


The text area element will display the same as above and it will not convert the font weight to bold which is expected in normal div element.

In your case, I see you need to display first line of text in bold and the next line in normal. So, why don't you use Pseudo-classes of CSS?

I have tried to create a sample and hopefully it meets your requirement: JS Bin - Collaborative JavaScript Debugging

Regards,

Sai.

0 Kudos

Awesome answer.

Sorry for my ignorance.

saivellanki
Active Contributor
0 Kudos

Sudarshan,

Don't be sorry!

No one is an expert here, everyone are learning new things day by day.

I remember a quote from Nicholas Butler (American Philosopher):

'An expert is one who knows more and more about less and less until he knows absolutely everything about nothing'

Have a great day ahead!

Regards,

Sai.

Answers (0)