Tasks with subtasks collapse by default - SharePoint 2013

Hello,

The subtask option in the SharePoint 2013 task list is great but by default the tasks and subtasks are expanded.  Is there a way to show these items collapsed by default?



  • Edited by CSjule Thursday, July 25, 2013 3:09 PM
July 25th, 2013 3:07pm

I too would like answer to this question.

I am looking to use task lists to tame a very large and fast-changing task list.  I need to go in and out of this "to-do" list many times a day.  If I have to manually collaspe each of dozens -- eventually maybe hundreds? -- of grouped tasks that are expanded by default, each time I open the webpage, then this loses any productivity gain for me.

Just FYI, you can't just use the "group by" function in view settings, on "task name" since this creates a group for each task, whether it is a parent task or a subtask.

  • Edited by RLParsons Tuesday, January 28, 2014 8:25 PM
Free Windows Admin Tool Kit Click here and download it now
January 28th, 2014 7:42pm

This is still an outstanding issue.

It seems ridiculous to not have a way to collapse by default, given that this is supposed to be an area where lots of tasks are being added.

I have tried using Javascript as a work around, to no avail.

March 6th, 2014 2:45pm

Adding another vote for a nice resolution to this issue. Microsoft?
Free Windows Admin Tool Kit Click here and download it now
March 18th, 2014 11:53pm

Seem to have it working with this bit of JS:

function doCollapseTaskList() { $(".ms-commentcollapse-iconouter > img").each(function(){ $(this).click(); }); }

$(function () { ExecuteOrDelayUntilScriptLoaded(function () { if (typeof asyncDeltaManager != "undefined") asyncDeltaManager.add_endRequest(doCollapseTaskList); else doCollapseTaskList(); }, "init.js"); });



March 19th, 2014 1:17am

Perfect! Thank you!
Free Windows Admin Tool Kit Click here and download it now
March 19th, 2014 1:26am

This looks promising but how/where do you implement this code?  I've tried the script editor web part, the content editor web part but no luck.  Any help would be greatly appreciated.
April 21st, 2014 8:03pm

Same here, tried the script in SharePoint 2013 Task list page, not working. Do I enable need to enable the MDS feature in the site feature page ? This is really critical as I have a task list with more than 300 tasks and expanding all tasks by default looks really cumbersome. Please advise. Appreciate your help. Note: Using IE 10.

Free Windows Admin Tool Kit Click here and download it now
April 25th, 2014 11:28pm

Where do you install this code? Tried a script editor web part and it does not work.
May 12th, 2014 4:44pm

Hello,

Please advise where to embed this code.  I've tried it as a snippet on the page but that's not working.  Thank you.

Free Windows Admin Tool Kit Click here and download it now
June 2nd, 2014 12:57pm

Not ideal, for sure, but perhaps a workaround. I created an additional field called MS standing for Main or Sub. Then created a default view which filters for only Mains and another which shows them all. I would love to see the collapse by default, too!
June 10th, 2014 2:01pm

Insert script editor web part and add below code

<script src="//code.jquery.com/jquery-1.10.2.js"></script>
<script src="//code.jquery.com/ui/1.10.4/jquery-ui.js"></script>
<script type="text/javascript">
jQuery(document).ready(function($) { 
(function($){
    function doCollapseTaskList() {
$(".ms-commentcollapse-iconouter > img").each(function(){
$(this).click();
});
}
$(function() {
  SP.SOD.executeOrDelayUntilScriptLoaded(function () {
if (typeof asyncDeltaManager != "undefined")
            asyncDeltaManager.add_endRequest(doCollapseTaskList);
          else doCollapseTaskList();
   },'SP.js');
    });
 
    })(jQuery);
  });
</script>

Free Windows Admin Tool Kit Click here and download it now
June 27th, 2014 5:51pm

<script src="//code.jquery.com/jquery-1.10.2.js"></script>
<script src="//code.jquery.com/ui/1.10.4/jquery-ui.js"></script>
<script type="text/javascript">
jQuery(document).ready(function($) { 
(function($){
    function doCollapseTaskList() {
$(".ms-commentcollapse-iconouter > img").each(function(){
$(this).click();
});
}
$(function() {
  SP.SOD.executeOrDelayUntilScriptLoaded(function () {
if (typeof asyncDeltaManager != "undefined")
            asyncDeltaManager.add_endRequest(doCollapseTaskList);
          else doCollapseTaskList();
   },'SP.js');
    });
 
    })(jQuery);
  });
</script>
June 27th, 2014 5:52pm

Insert script editor web part and add below code

<script src="//code.jquery.com/jquery-1.10.2.js"></script>
<script src="//code.jquery.com/ui/1.10.4/jquery-ui.js"></script>
<script type="text/javascript">
jQuery(document).ready(function($) { 
(function($){
    function doCollapseTaskList() {
$(".ms-commentcollapse-iconouter > img").each(function(){
$(this).click();
});
}
$(function() {
  SP.SOD.executeOrDelayUntilScriptLoaded(function () {
if (typeof asyncDeltaManager != "undefined")
            asyncDeltaManager.add_endRequest(doCollapseTaskList);
          else doCollapseTaskList();
   },'SP.js');
    });

    })(jQuery);
  });
</script>

 
Free Windows Admin Tool Kit Click here and download it now
June 27th, 2014 5:52pm

Insert script editor web part and add below code

<script src="//code.jquery.com/jquery-1.10.2.js"></script>
<script src="//code.jquery.com/ui/1.10.4/jquery-ui.js"></script>
<script type="text/javascript">
jQuery(document).ready(function($) { 
(function($){
    function doCollapseTaskList() {
$(".ms-commentcollapse-iconouter > img").each(function(){
$(this).click();
});
}
$(function() {
   SP.SOD.executeOrDelayUntilScriptLoaded(function () {
 if (typeof asyncDeltaManager != "undefined")
            asyncDeltaManager.add_endRequest(doCollapseTaskList);
          else doCollapseTaskList();
    },'SP.js');
    });

    })(jQuery);
  });
</script>

 
June 27th, 2014 5:52pm

Thanks Alan,

That script worked as promised.  When I change views the tasks aren't collapsed.  Do you have any suggestions for a fix for this?

Thanks

Peter

Free Windows Admin Tool Kit Click here and download it now
July 28th, 2014 10:10pm

That script does not work on my page. Unless I'm mistaken you cannot add any web part to a task list?

Do you have to create a web part of the task list and put it on a wiki/web part page and then add the script editor with script?

August 14th, 2014 8:47am

Thanks a lot, this Solution worked like a charm for me :)
Free Windows Admin Tool Kit Click here and download it now
August 14th, 2014 9:42am

A New aspx ( viewname.aspx) page create while you create a new view for task list. So You should insert script editor web part and add the same code again in new view page.

Thanks

A

August 15th, 2014 8:26pm

This is really frustrating !

I used this script : checked out page, inserted script editor, inserted the snippet, saved, reloaded page and it worked perfectly.

I then reorganised the list .... and the damned thing refused to work from then on. I tried deleting the editor and re-inserting the editor and the snippet .... nope .... just refused to work a second time.

Aaaaggghhh


Free Windows Admin Tool Kit Click here and download it now
August 21st, 2014 12:58am

Ah!

I take it back - I completely closed the site and browser; went back to it later and the script is now effective again.

Go figure - but ho hum it's working - thanks alancejacob

Mike

August 21st, 2014 1:35am

Hi Alan,

I added the Script Editor and cut & past the script you attached

Saved the page and reloaded the page nothing happened

Am I missing anything?

Free Windows Admin Tool Kit Click here and download it now
August 28th, 2014 7:21pm

It did not work for me as is, Do I have to add any extra code or do I need a button on the page?

To me it is not completed, or am I missing something?

This is what I Cut and pasted in Script Editor

<script src="//code.jquery.com/jquery-1.10.2.js"></script>
<script src="//code.jquery.com/ui/1.10.4/jquery-ui.js"></script>
<script type="text/javascript">
jQuery(document).ready(function($) { 
(function($){
    function doCollapseTaskList() {
$(".ms-commentcollapse-iconouter > img").each(function(){
$(this).click();
});
}
$(function() {
  SP.SOD.executeOrDelayUntilScriptLoaded(function () {
if (typeof asyncDeltaManager != "undefined")
            asyncDeltaManager.add_endRequest(doCollapseTaskList);
          else doCollapseTaskList();
   },'SP.js');
    });

    })(jQuery);
  });
</script>

September 3rd, 2014 8:23pm

I am having the same issue. This script doesnt seem like it is working for me either.
Free Windows Admin Tool Kit Click here and download it now
October 7th, 2014 5:18pm

The solution here isn't completed. Below is the script that will work if you put it in a Content Editor Webpart's Code.

<script src="</script">https://code.jquery.com/jquery-1.10.2.js"></script>
<script src="</script">https://code.jquery.com/ui/1.10.4/jquery-ui.js"></script>
<script type="text/javascript">
function doCollapseTaskList() {
 $(".ms-commentcollapse-iconouter > img").each(function(){
  $(this).click();
 });
}


$(function () {
      ExecuteOrDelayUntilScriptLoaded(function () {
          if (typeof asyncDeltaManager != "undefined")
            asyncDeltaManager.add_endRequest(doCollapseTaskList);
          else doCollapseTaskList();
      }, "SP.Core.js");
});
</script>

March 18th, 2015 2:20pm

Tried this solution and it is not working.. for me. :/

Tried both using the script editor and content editor on the wikipage and on tasks webpart page.

Do I need to add any features? I used the built in tasks with the timeline does it effect?

Can anyone please advice?

Free Windows Admin Tool Kit Click here and download it now
April 23rd, 2015 9:37am

When I reload the page the script works. But when I close the browser it does not run the script anymore.. :/

any suggestions?

May 18th, 2015 12:55pm

This work perfectly when it displays the list but when I select Edit List it expands back out to the full list.

So question is how do you get this work in the edit mode?

Regards

A

Free Windows Admin Tool Kit Click here and download it now
June 6th, 2015 11:33am

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics