JavaScript Conditional Formatting

Hi-

I am trying to apply some conditional formatting to a table.  It looks like it can be done by writing javascript (see link below).  It mentions that you can write javascript within the HTML Macro but I can’t get it to work.  Are there instructions anywhere on how to write javascipt on a confluence page?

http://stackoverflow.com/questions/5066882/conditional-formatting-of-html-table-cells

Thanks!

2 answers

0 vote
Thomas Schlegel Community Champion Mar 16, 2017

Hi Joel,

we add javascript with User Macros to a Confluence page.

Hello!

For conditional formatting in Confluence you may use CelesteCS Conditions for Confluence.

Assume you need to set a specific background color for some values on your table, for example, for 'Yes' make it light-green and for 'No' make it light-red. You just put your table into Conditional Rules Manager macro and add two Conditional Rule macros to specify rules of type 'Element Value Is Equal To', which is by default. In one of the rules you specify 'Value 1' = 'Yes' and 'Background color' = 'highlight-green' and in another one 'Value 1' = 'No' and 'Background color' = 'highlight-red'. That's it! The cells will be formatted appropriately.

As you see, it's very simple - just add a couple of macros and configure it properly. No need for doing it manually, writing user macros or use source code editors.

There are more than a dozen of conditional rule types supported. Plus, you may replace the text, not just to format it.

Thanks!

Suggest an answer

Log in or Sign up to answer
Atlassian Community Anniversary

Happy Anniversary, Atlassian Community!

This community is celebrating its one-year anniversary and Atlassian co-founder Mike Cannon-Brookes has all the feels.

Read more
Community showcase
Kesha Thillainayagam
Posted Apr 13, 2018 in Confluence

We want to hear how your non-technical teams are using Confluence!

Hi Community! Kesha (kay-sha) from the Confluence marketing team here! Can you share stories with us on how your non-technical (think Marketing, Sales, HR, legal, etc.) teams are using Confluen...

359 views 20 10
Join discussion

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you