none
expand collapsible view in document library RRS feed

  • Question

  • Hi,

    I have a document library with with folders and sub folders.I want to create a customized view with expand collapsible view like when i click on folder all sub folders show and when click on subfolder all sub folders inside that and when i click on sub folder all documents needs to be visible.Iam implementing this online and please help me on achieving this.

    Regards,

    Praveen

    Wednesday, October 16, 2019 11:42 AM

Answers

  • Hi Praveen,

    We can open the document library list view in SharePoint designer, and add the code below under the "PlaceHoderMain".

    <SharePoint:SPHierarchyDataSourceControl id="doclibDataSource" runat="server" RootContextObject="List" ShowFolderChildren="true" EnableViewState="false">
    </SharePoint:SPHierarchyDataSourceControl>
    <SharePoint:SPTreeView ID="doclibtreeview" runat="server" DataSourceID="doclibDataSource" EnableViewState="false" ExpandDepth="2" SelectedNodeStyle-CssClass="ms-tvselected">
    </SharePoint:SPTreeView>
    

    Or we can use the OOTB metadata navigation in document library, go to Library Settings->Metadata navigation settings, add "Content Type" into "Selected Hierarchy Fields:" in Configure Navigation Hierarchies.

    Or we can also use custom code to achieve it. The following article for your reference.

    Display Document Library Folders And Files In Tree View

    Best Regards,

    Dennis


    Please remember to mark the replies as answers if they helped. If you have feedback for TechNet Subscriber Support, contact tnmff@microsoft.com.

    SharePoint Server 2019 has been released, you can click here to download it.
    Click here to learn new features. Visit the dedicated forum to share, explore and talk to experts about SharePoint Server 2019.

    • Marked as answer by Praveenrangu Friday, October 18, 2019 5:25 AM
    Thursday, October 17, 2019 4:45 AM
    Moderator

All replies

  • Hi Praveen,

    We can open the document library list view in SharePoint designer, and add the code below under the "PlaceHoderMain".

    <SharePoint:SPHierarchyDataSourceControl id="doclibDataSource" runat="server" RootContextObject="List" ShowFolderChildren="true" EnableViewState="false">
    </SharePoint:SPHierarchyDataSourceControl>
    <SharePoint:SPTreeView ID="doclibtreeview" runat="server" DataSourceID="doclibDataSource" EnableViewState="false" ExpandDepth="2" SelectedNodeStyle-CssClass="ms-tvselected">
    </SharePoint:SPTreeView>
    

    Or we can use the OOTB metadata navigation in document library, go to Library Settings->Metadata navigation settings, add "Content Type" into "Selected Hierarchy Fields:" in Configure Navigation Hierarchies.

    Or we can also use custom code to achieve it. The following article for your reference.

    Display Document Library Folders And Files In Tree View

    Best Regards,

    Dennis


    Please remember to mark the replies as answers if they helped. If you have feedback for TechNet Subscriber Support, contact tnmff@microsoft.com.

    SharePoint Server 2019 has been released, you can click here to download it.
    Click here to learn new features. Visit the dedicated forum to share, explore and talk to experts about SharePoint Server 2019.

    • Marked as answer by Praveenrangu Friday, October 18, 2019 5:25 AM
    Thursday, October 17, 2019 4:45 AM
    Moderator
  • Hi Praveen,

    Thanks for marking my reply as answer. I’m pleased to know that the information is helpful to you. I hope you are delighted with the service we provided you.
    Here I will provide a brief summary of this post for your information.

    Requirement:

    Expand collapsible view in document library

    Solution:

    We can open the document library list view in SharePoint designer, and add the code below under the "PlaceHoderMain".

    <SharePoint:SPHierarchyDataSourceControl id="doclibDataSource" runat="server" RootContextObject="List" ShowFolderChildren="true" EnableViewState="false">
    </SharePoint:SPHierarchyDataSourceControl>
    <SharePoint:SPTreeView ID="doclibtreeview" runat="server" DataSourceID="doclibDataSource" EnableViewState="false" ExpandDepth="2" SelectedNodeStyle-CssClass="ms-tvselected">
    </SharePoint:SPTreeView>


    Or we can use the OOTB metadata navigation in document library, go to Library Settings->Metadata navigation settings, add "Content Type" into "Selected Hierarchy Fields:" in Configure Navigation Hierarchies.

    Best Regards,

    Dennis


    Please remember to mark the replies as answers if they helped. If you have feedback for TechNet Subscriber Support, contact tnmff@microsoft.com.

    SharePoint Server 2019 has been released, you can click here to download it.
    Click here to learn new features. Visit the dedicated forum to share, explore and talk to experts about SharePoint Server 2019.

    Friday, October 18, 2019 7:57 AM
    Moderator