I'm using SharePoint 2013 to keep track of projects and their sub-tasks. But the view is getting pretty long and it would be nice to have a button to collapse all subtasks, leaving only the top-level parent tasks. Most to do lists have this functionality. I found a jQuery solution that didn't work, but I haven't found any other solutions. I'd rather not farm each project off to its own sub-site with it's own list.
1 Answer
I was also struggling with the jquery as it was getting looped.
Then found a response from Cristy on https://stackoverflow.com/questions/14542684/document-ready-function-being-called-over-and-over
To Use $(window).load
Below is the script.
Add it to Content Editor Webpart with in the script tag
function doCollapseTaskList() {
$(".ms-commentcollapse-iconouter > img").each(function(){
$(this).click();
});
}
$(window).load(function () {
doCollapseTaskList();
});
Good Luck