Let's follow up this discussion at the Neptune Community

(this forum will be kept in read-only mode)

hash navigation

I would like to achieve something similar to what you are doing in your 'Explored' solution with hash navigation. By clicking url I would like to open an App running withing the launchpad rather than going to the main launchpad screen with tiles. How to achieve this? An example of sample code would be appreciated.


Thanks,


Radek

1 Comment

In order to retrieve your URL parameter just get the URL from location.href and use it with an Ajax-Call or any other JS-coding. 

This is a JS code-snippet to get just the value of your url parameter:

 

function getQueryParameter(param) {

    var query = window.location.search.substring(1);

    var vars = query.split("&");

    for (var i = 0; i < vars.length; i++) {

        var pair = vars[i].split("=");

        if (pair[0] == param) {

            return pair[1];

        }

    }

    return (false); 

}


Basically you then only have to pass a parameter with your URL (e.g. 'applid') and fire a tile-press event within your launchpad after fetching the parameter:


function appNavigation() {

   setTimeout(function() {

        if (getQueryParameter("applid")) {

            var tile = ModelData.Find(AppCacheShellList, "APPLID", getQueryParameter("applid"), "EQ"); 

            if (tile.length) {

            sap.n.Launchpad.HandleTilePress(tile[0]);

        } } else {

            // do nothing

        }

    }, 200);

}


If you want to use hashNavigation here is some sample-code from Explored:


function hashNavigation() {

    setTimeout(function() {

        if (location.hash.substring(1, 4) == 'doc') {

            getOnlinepageDoc(location.hash.substring(1, 99));

        } else {

            getOnlinepageObject(location.hash.substring(1, 99));

        }

    }, 200);

}

window.onhashchange = hashNavigation;

// Trigger on first request

if (location.hash) {

    hashNavigation();

}


Kind regards

Christoph

Login or Signup to post a comment