Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Is it possible to change the table row background color dynamically with scaffolding plugin?

Thomas Schlegel
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
June 30, 2015

Hi everyone,

I try to find a solution to the following tricky problem:

  • I have a table-data table on a confluence page (using the scaffolding plugin)
  • Users can dynamically create new rows in this table
  • The background color of the newly created row should be set
    • either by finding a keyword in a specific column or
    • by adding some kind of css into the td or text-data field

Is this possible? Has anyone done something similar and give me some advice?

Thank you

Thomas

7 answers

1 accepted

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

Post a new question

0 votes
Answer accepted
xpauls
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
July 1, 2015

How I see it, you should use jQuery and make it act on some keyword, or use text-data or list-data to specify which type of data it is. Which one would work for you best?

Thomas Schlegel
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
July 1, 2015

Just a little more documentation in case someone is looking for something similar: 1) Add a CSS stylesheet on the page: .greenBG { background: green: } 2) Add a script like this on the page: <script type="text/javascript"> AJS.toInit(function(){ AJS.$("td:contains('green')").parent().addClass('greenBG'); }); </script>

Gerrit Berberich January 30, 2018

Hi Thomas,

this comment is quite interesting. Is it still working with e.g. version 6.5.x?

Where do you place CSS? Administration > Look and Feel > Stylesheet?

The jQuery is part of the user macro?

I have tried something with Confluence classes but I don't get it run:

$("td:contains('1')").addClass('highlight-red confluenceTd');

Thanks for your help

0 votes
xpauls
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
July 1, 2015

Glad I could help.

0 votes
Thomas Schlegel
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
July 1, 2015

Thank you so much for pointing me to the jQuery direction!! It is working great. Pleasae convert your comment to an answer, so I can accept it.

0 votes
Thomas Schlegel
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
June 30, 2015

No, it should get its background color by inserting the row and keep that color. The color is representing a different kind of data, e.g. the red colored rows are somehow different from the green ones. Ideally, the color should be changed by edititing the table data.

0 votes
xpauls
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
June 30, 2015

So only the new rows are highlighted? And color from previously colored rows are removed?

0 votes
Thomas Schlegel
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
June 30, 2015

The color should persist after saving the page.

0 votes
xpauls
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
June 30, 2015

Should the background color only be changed during editing or it should persist after saving the page?

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

Post a new question

TAGS
AUG Leaders

Atlassian Community Events