0

I'm trying to edit script editor webpart in Sharepoint 2013 online (chrome removed) so that all grouped sublists would be collapsed by default. It's already set to collapsed by default in document library view options. But when i expand grouped list on the site it will be shown after page reload though.

Something like that was already discussed there but it still doesn't working to me.

Here is my last version.

<script type="text/javascript" src="http://code.jquery.com/jquery-1.2.6.min.js"></script>
<script type="text/javascript">

$(document).ready(function () {
   $(".ms-commentcollapse-icon").click();
});
</script>
0

Try Using below code:

<script type="text/javascript" src="http://code.jquery.com/jquery-1.2.6.min.js"></script>
<script type="text/javascript">
    $(document).ready(function () {
        debugger;
        $("span.ms-commentcollapse-iconouter").each(function(index, node) {
            node.click();
        });
    });
</script>

Note:

Make sure you have added this script editor after (below all list web-parts in page) all your list web-parts.

  • Does not work. ;( – dancingsushii Sep 16 at 13:05
  • Have you put inside document.ready()? – Ganesh Sanap Sep 16 at 13:06
  • Yeap. $(document).ready(function () { document.querySelectorAll("span.ms-commentcollapse-iconouter").forEach(function(node) { node.click(); }); }); – dancingsushii Sep 16 at 13:16
  • Try updated code from answer. – Ganesh Sanap Sep 16 at 13:18
  • No changes. May be the problem is because it´s document library, not list? – dancingsushii Sep 16 at 13:37

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.