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
Technology Tips and News
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?
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.
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.
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"); });
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.
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.
Insert script editor web part and add below code
<script src="//code.jquery.com/jquery-1.10.2.js"></script>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>
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>
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
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?
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
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
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
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?
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>
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>
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?
When I reload the page the script works. But when I close the browser it does not run the script anymore.. :/
any suggestions?
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