cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Fiori Elements - How to detect navigation and read routing parameters in a custom page (controller)

cgerold
Explorer
0 Likes
1,008

Hi everyone,

I'm developing a Fiori Elements app using UI5 version 1.120.x. The app includes a ListReport and an ObjectPage. I've now added a third view using a custom page based on the Flexible Programming Model. The new view is called Employee, and its controller extends from sap/fe/core/PageController.

I’m trying to figure out two things:

  1. How can I detect when the navigation to this custom page has occurred?

  2. How can I read optional routing parameters that might have been passed during navigation?

I noticed that when using a Controller Extension, it's possible to override certain lifecycle methods like onBeforeBinding or onAfterBinding, as shown here:
https://sapui5.hana.ondemand.com/test-resources/sap/fe/core/fpmExplorer/index.html#/controllerExtens...

However, this approach doesn’t seem to work for view controllers that inherit directly from sap/fe/core/PageController. Is there an equivalent or recommended way to hook into the navigation lifecycle for such custom pages?

Any guidance or examples would be greatly appreciated!

Thanks a lot!

View Entire Topic
cgerold
Explorer
0 Likes

I made the mistake of reading the component using getOwnerComponent(). However, if you read the component within a controller using this.getAppComponent(), you can then access this.getAppComponent().getRouter() and intercept the necessary events there.