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>

1 Answer 1

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.

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