How to configure a "Navigate Up" link/button for sublibraries on forms

Document created by ChristofN Employee on May 7, 2018Last modified by ChristofN Employee on Jan 14, 2019
Version 2Show Document
  • View in full screen mode

Are you missing the possibility to navigate up in folders on your sublibraries placed on forms?

Here is a proposed solution to accomplish this requirement with a button/link and form load action.

 

Result for endusers

 

How to configure

 

   1. Form Load Action

 

    Function code expression:

window.dossierListName = "ContactsDossier";
window.dossierSubLibraryInternalName = "ContactDocuments";
window.dossierSubLibraryDisplayName = "Contact Documents";
var navigateUpLink = ArdeviaJQuery("#navigateUpLink");
window.dossierItemID = [[ID]];
window.subLibraryWebPart = g_uploadCtl[ArdeviaJQuery("[ard-sublibrary-title='" + encodeURI(window.dossierSubLibraryDisplayName) + "'] div[id^=WebPartWPQ]").attr("id")];
var original_HandleFolder = HandleFolder;

window.HandleFolder = function(p1, p2, folderUrl) {
original_HandleFolder(p1, p2, folderUrl);
setFolderNavigateLinkVisibility();
};

function setFolderNavigateLinkVisibility() {
if(window.subLibraryWebPart.strRootFolder !== "/" + window.dossierSubLibraryInternalName + "/" + window.dossierListName + "-" + window.dossierItemID) {
navigateUpLink.show(200);
} else {
navigateUpLink.hide(400);
}
};
setFolderNavigateLinkVisibility();

Replace ContactsDossierContactDocuments and Contact Documents with list/library names (check Internal- and DisplayNames) of your solution.

   2. Button/Link Action

 

    Function code expression:

HandleFolder(null, null, location.pathname + "?RootFolder=" + window.subLibraryWebPart.strSiteRelativeUrl + window.subLibraryWebPart.strRootFolder.substring(0, window.subLibraryWebPart.strRootFolder.lastIndexOf('/')) + "&View={" + ArdeviaJQuery("table.ms-listviewtable[summary='" + window.dossierSubLibraryDisplayName + "']").attr("view") + "}");

Add the following id attribute to your new created link for jQuery selector: id="navigateUpLink"

 

Attachments

    Outcomes