cancel
Showing results for 
Search instead for 
Did you mean: 

FLP nav back button issue

arumallaanusha
Explorer

Hello Everyone
Greetings of the day!
I am unable to solve my issue can anyone help me out for solving this issue.
In my application I have two views. In the second view when I click on the FIori nav back button i need to add some Warning message when the user is not saved his data. And when user clicked on OK button of dialog it should navigate to the first view. It is navigating. My problem is when i click on the FIori nav back button on First view it is not navigating to the FLP Home screen.
I tried this link but unable to solve
Thanks in advance
Anusha

0 Kudos

Hi Anusha ,

We need add the event from your custom application to navigation back to the FIORI launchpad .Below code may help you to resolve your issues.

onAfterRendering: function() {

    var homeBtn = sap.ui.getCore().byId("homeBtn").getDomRef();

    $($(homeBtn).find("a")).on("click", function(event) {
        // do this if user do not want to navigate to launchpad
        event.preventDefault();
    });
}

Accepted Solutions (1)

Accepted Solutions (1)

former_member540067
Active Participant

Hi,

Add below code in your manifest:

...
"sap.ui5": {
     "services": {
        "ShellUIService": {
            "factoryName": "sap.ushell.ui5service.ShellUIService"
        }
    }
    ...
}
...

and below code in controller:

this.getOwnerComponent().getService("ShellUIService").then(function(oShellService) {
    oShellService.setBackNavigation(function() {
        //either do nothing to disable it, or add your own nav back logic for having the navigation
    });
});

Regards

Anmol

soumya_r
Participant
0 Kudos

Hi Anmol,

i tried this in my application to go to FLP directly than previous view. i put below code inside setbacknavigation method.

sap.ushell.Container.getService("CrossApplicationNavigation").toExternal({ target: { // semanticObject: "" shellHash: "#" } });

how do i put the logic of navigating back to FLP without the below error?

the URL "# " is not compliant. It may break the product and cause unwanted navigation behavior."

after this error, the entire FLP becomes inaccessible or stuck or no tile works.

i am getting this error. how do i go back to the FLP from my 3rd level view to FLP directly with this button?

thanks,

Soumya

amita_jain2
Participant
0 Kudos

Hi Anmol I tried this but onAfterrendering is not getting called when click on back button. Any advice

onAfterRendering: function() {

this.getOwnerComponent().getService("ShellUIService").then(function(e) {

e.setBackNavigation(function() {

sap.ui.getCore().byId("shellAppTitle").setText(this._getText("headertitle"))

})

})

Answers (1)

Answers (1)

avinashhr041
Explorer
0 Kudos

Hi,

If we have to use this code for single controller i.e for one page, then how we can handle this.

I have tried above approach and works fine for me. But it is getting reflected in other pages as well.

But I have to use this event to only one page i.e. for one controller.

Kindly suggest.

Thanks in advance !