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

Next challenges

Recent achievements

  • Global
  • Personal

Recognition

  • Give kudos
  • Received
  • Given

Leaderboard

  • Global

Trophy case

Kudos (beta program)

Kudos logo

You've been invited into the Kudos (beta program) private group. Chat with others in the program, or give feedback to Atlassian.

View group

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage
Highlighted

Feature Request: Insert checkbox column

The "Insert numbering column" feature is very useful.

We could also use "Insert checkbox column" so that each row in a table would have a checkbox.  This would allow a long list of rows to instantly be transformed into a task list!

2 comments

Hi @Michael Woffenden 

you may want to set a feature request here in JIRA as a 'Suggestion' directly at Atlassian after checking if there's already a similar request for this feature. Couldn't find one with a short check yet. 

By the way I may also find this useful - but there's already a list function in task macro which could make this difficult. Maybe there could be an opportunity using an user macro as you are on-premise which offers these options, too, depends on what you wanna you use it for.

BR

Hello @Fabienne Gerhard ... great idea to create a suggestion.  I actually had no idea where do to that.  (I've also noted that feature request link in our Confluence KB.)

@Fabienne Gerhard: I'm wondering, how you would make an user macro for this purpose. He wants to just click a button and this should add a checkbox in the first column of all rows. 

I have another solution for that. It might look a little bit of a hack :) 

Let me introduce you bookmarklets. Bookmarklets are javascripts, which will be executed, when you click the bookmark. And for your request, I tried to create a bookmarklet.

What does my bookmaklet?

  • It searches the iframe, where the wysiwyg editor is. In my confluence, the ID of that iFrame is: "wysiwygTextarea_ifr". It might be different in other instances. 
  • Then it searches all tables. And i mean all tables in the page! 
  • Then I search all <tr> and <td> tags and just add another <td>-tag before the others
  • In this pasted <td>, I add the checkbox.

The script in full length is at the end of the post. 

How can you use the bookmarklet? 

  • Just add a bookmark
  • Name it
  • the URL is the following:
javascript&colon;(function(){window.s0=document.createElement('script');window.s0.setAttribute('type','text/javascript');window.s0.setAttribute('src','https://bookmarkify.it/bookmarklets/17523/raw');document.getElementsByTagName('body')[0].appendChild(window.s0);})();

Now just try it out. If you have a table and you are in the edit mode, just click the bookmark and then, there should be a checkbox in the first column of every row. (I hope it does)

If this doesn't helped or you have further questions, don't hesitate to ask. 

Regards, Dominic

 

And here is the dirty javascript

function createElementFromHTML(htmlString) {
var div = document.createElement('div');
div.innerHTML = htmlString.trim();

// Change this to div.childNodes to support multiple top-level nodes
return div.firstChild;
}


var iframe = document.getElementById("wysiwygTextarea_ifr");
var table = iframe.contentWindow.document.getElementsByClassName("confluenceTable");
//var table = document.getElementsByClassName("confluenceTable");
var tr = table[0].getElementsByTagName("tr");

for (var i = 0;i<tr.length;i++){
var td = tr[i].getElementsByTagName("td");
var th = tr[i].getElementsByTagName("th");

if (td.length > 0){
var first = td[0];
var newItem = document.createElement("td");
newItem.className = "confluenceTd";

var text = createElementFromHTML("<ul class='inline-task-list'><li data-inline-task-id=''><br data-mce-bogus='1'></li></ul>");
newItem.appendChild(text);
tr[i].insertBefore(newItem, first);
}

if (th.length > 0){
var first = th[0];
var newItem = document.createElement("th");
newItem.className = "confluenceTh";
var text = document.createTextNode("");
newItem.appendChild(text);
tr[i].insertBefore(newItem, first);
}
}

 

Comment

Log in or Sign up to comment
TAGS
Community showcase
Posted in Confluence

What do you think is the most *delightful* Confluence feature? Comment for a prize!

- Create your own custom emoji 🔥 - "Shake for Feedback" on mobile 📱 - An endless supply of GIFs via GIPHY 🤩 Is there anything quite as nice as a pleasant surprise? Comment below with what...

387 views 23 8
Join discussion

Community Events

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

Find an event

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

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you