Skip to Content
Author's profile photo Jerry Wang

An example of how to find back button implementation on Smart Template generated application

One of my colleagues today asked me this question: Suppose this below is an application generated by Smart Template, and I would like to debug how the back button is implemented. Since the whole UI page is implemented by framework, I don’t know where to set breakpoint. How to proceed?

/wp-content/uploads/2016/05/clipboard1_943906.png

Here below is my process about how to find the back implementation in framework file within several minutes.

1. Use Chrome extension Inspector ( the UI5 tab in Chrome development tool below ) to figure out that the button is located in UI area sap.uxap.ObjectPageHeader.

/wp-content/uploads/2016/05/clipboard2_943907.png

Based on the learning in My understanding about how object page in Smart Template is rendered I search by keyword “Back” in file Details.view.xml first, no result.

/wp-content/uploads/2016/05/clipboard3_943908.png

2. Then search in next xml file NavigationBar.fragment.xml, this time the button is found.

/wp-content/uploads/2016/05/clipboard2_943907.png

Perform global search via Ctrl+Shift+F with key word “_templateEventHandlers.onBack“, no result.

/wp-content/uploads/2016/05/clipboard3_943908.png

Then search “_templateEventHandlers” instead, this time TemplateAssembler-dbg.js is found.

/wp-content/uploads/2016/05/clipboard4_943920.png

Unfortunately it is difficult to judge the type of _templateEventHandlers simply from context code as it is filled in a generic way.

/wp-content/uploads/2016/05/clipboard5_943921.png

3. Perform search on onBack instead, and the result is what I am looking for:

/wp-content/uploads/2016/05/clipboard6_943926.png

Set a breakpoint and click back button to verify: breakpoint is triggered:

/wp-content/uploads/2016/05/clipboard7_943927.png

So the trick here is the keyword I am using to search in a tentative way.

  • first time search by _templateEventHandlers.onBack, no result
  • second time search by _templateEventHandlers, has result but not useful
  • third time search by onBack, done.

Assigned tags

      1 Comment
      You must be Logged on to comment or reply to a post.
      Author's profile photo Former Member
      Former Member

      can you please tell me also how to invoke the same from the controller as well.

      thanks

      Himanshu