![Trending Articles on Technical and Non Technical topics](/images/trending_categories.jpeg)
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
OnInit method is not getting called again when navigating back and forth from a view in SAPUI5
You have identified the correct use case as it is by design as you have navigated back and forth, it renders the last version rendered and OnInit() does not gets called. But if you want to override this behavior, SAP lets you do it.
You can delegate to the patternMatched event of router, so that wheever the view is rendered the OnInit() method is invoked.
this.getOwnerComponent().getRouter().getRoute("<Route name>").attachPatternMatched(<Your Handler>, this);
You need to attach the even handler to the router in the init method of the controller. Hope it helps and sorts out your requirement.
Advertisements