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

Document created by ChristofN Employee on May 7, 2018
Version 1Show 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.dossierSubLibraryName = "ContactDocuments";
var navigateUpLink = ArdeviaJQuery("#navigateUpLink");
window.dossierItemID = [[ID]];
window.subLibraryWebPart = g_uploadCtl[ArdeviaJQuery("[ard-sublibrary-title=" + window.dossierSubLibraryName + "] 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.dossierSubLibraryName + "/" + window.dossierListName + "-" + window.dossierItemID) {
          navigateUpLink.show();
     } else {
          navigateUpLink.hide();
     }
};
setFolderNavigateLinkVisibility();

    Replace ContactsDossier and ContactDocuments with list/library names 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.dossierSubLibraryName + "]").attr("view") + "}");

 

 

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

 

Attachments

    Outcomes