cancel
Showing results for 
Search instead for 
Did you mean: 

Navigation with filters inside a Fiori Elements oData v4 app

carlonnheim
Participant
0 Kudos

Hi,

I am trying to achieve a navigation scenario from an Object Page in a Fiori Elements app (oData v4) to a List Report page in the same app, keeping some filters from the source page.

If the target page is in a different app this works out of the box using Intent Based Navigation. I can use code like this (see documentation)

 

oIntentBasedNavigation.navigateOutbound('myOutboundNavigation', { SomeProperty: '1337'});

 

Which triggers navigation to a URL like this

 

https://...hana.ondemand.com/site#MyObject-MyAction?SomeProperty=1337

 

If the target app is a "List Report Object Plan" floorplan, and the target entity has a field named "SomeProperty", the list is filtered by the given value (or if that happens to be the full key, it navigates to the ObjectPage) - as expected.

Now, I want to achieve the same result within an app. From an event handler somewhere in the app I can do like that

 

this.getRouting().navigateToRoute('MyObjectList', {
    '?query': {
        SomeProperty: '1337',
    }
})

 

Which triggers navigation to the desired route, looking like this

 

{"sap.ui5": {
...
"routing": {
    "routes": [
        {
            "pattern": ":?query:",
            "name": "MyObjectList",
            "target": "MyObjectList"
        },
...
}

 

But the url is different (the query parameters now go into the routing part of the hash), like this

 

https://...hana.ondemand.com/site#MyObject-MyAction&/?SomeProperty=1337

 

The list report page loads, but it does not pick up the filter. If I manually remove the "&/" part, it becomes an Intent-navigation and the filter gets set, but that also triggers a reload of the whole app.

What is the proper way to achieve this navigation scenario? I have also been trying:

  • Intent navigation - this is possible but it makes the navigation "external", triggering a page refresh which is not right
  • App state - the inbound navigations work through the appstate to set the filters, but it is not apparent how to fill these filter fields (if even possible)

To put the scenario in a little context, we are using a "Custom Root View" which loads a ToolPage around the FE pages. The tool page provides navigation to different ListReport pages in the app and I need this navigation pattern to move from one object to a list of related objects.

Hoping somebody can provide input on the proper approach, thanks in advance!

//Carl

Accepted Solutions (0)

Answers (0)