Skip to main content
edited to include a jQuery hack to fix the text alignment
Source Link
MdMazzotti
  • 4.8k
  • 3
  • 18
  • 35

I think the easiest way to accomplish what you're trying to do is modifying the calculated column so that it can emit html formatted string directly.

Change the return type of your calculated column to Number, then edit the formula to something like:

=Title="<span class='fixMyHead'>" & Title & " <b>(Compliant)</b>"b></span>"

This will save you from havingNow, in order to do jQuery hacks for suchleft-align the column td and th, you can use a trivial thingbit of jQuery:

$('.fixMyHead').each(function(){  
    $td = $(this).parents('td:first');   
    $td.closest('table').find('th').eq($td.index()).find('.ms-numHeader').css('text-align', 'left');
    $td.children(':first').css('text-align', 'left');
});

I think the easiest way to accomplish what you're trying to do is modifying the calculated column so that it can emit html formatted string directly.

Change the return type of your calculated column to Number, then edit the formula to something like:

=Title & " <b>(Compliant)</b>"

This will save you from having to do jQuery hacks for such a trivial thing

I think the easiest way to accomplish what you're trying to do is modifying the calculated column so that it can emit html formatted string directly.

Change the return type of your calculated column to Number, then edit the formula to something like:

="<span class='fixMyHead'>" & Title & " <b>(Compliant)</b></span>"

Now, in order to left-align the column td and th, you can use a bit of jQuery:

$('.fixMyHead').each(function(){  
    $td = $(this).parents('td:first');   
    $td.closest('table').find('th').eq($td.index()).find('.ms-numHeader').css('text-align', 'left');
    $td.children(':first').css('text-align', 'left');
});
Source Link
MdMazzotti
  • 4.8k
  • 3
  • 18
  • 35

I think the easiest way to accomplish what you're trying to do is modifying the calculated column so that it can emit html formatted string directly.

Change the return type of your calculated column to Number, then edit the formula to something like:

=Title & " <b>(Compliant)</b>"

This will save you from having to do jQuery hacks for such a trivial thing