A.G.Progm.Enthusiast
A.G.Progm.Enthusiast

Reputation: 1010

How to partly change the font of a webix datatable cell?

I have below datatable in which one of the cells (1st row, Message column) is colored. All the cells under the Message column is showing a multiline message.

Snippet : https://webix.com/snippet/cf9d8a62

Instead of coloring the entire cell, I want the font of one of the items to be colored or bold. For example, I want only the 'world' in that cell to be colored as green or as bold.

Can this be done ? Please help.

Thanks.

Upvotes: 1

Views: 319

Answers (1)

VilleKoo
VilleKoo

Reputation: 2854

You could use Template literals here and modify your for loop.

for(var i in p_list) {
 var item = p_list[i];
 if (item === 'world') {
   item = `<span style="color:green;font-weight:bold">o ${item}</span>`;

   /* 
   or you can give it a class and style the item accordingly in css
   item = `<span class="green">o ${item}</span>`;
   */

 } else {
   item = `<span>o ${item}</span>`;
 }

   e_item += item + "<br>";
 }

Upvotes: 1

Related Questions