Quantcast
Channel: SCN : Discussion List - SAP Fiori
Viewing all articles
Browse latest Browse all 1804

Master-Detail: show number of elements on the filter tab

$
0
0

Hi,

 

I am learning to create fiori apps with the hana cloud platform. I have created a fiori master detail app and specified my OData model as well as mock data ( I don't have a backend service).

 

The app is pretty simple, the master contains a set of elements for which the details are shown in the Detail view in two tabs. One tab contains general information and the second contains a table. This second tab's count property must contain the table's number of rows.

 

What I have tried so far is to get the number of rows (Detail.controller.js):

 

this.byId("__table0").getItems().length 

and put it in the tab filter's count property:

 

this.byId("iconTabFilter2").setCount(this.byId("__table0").getItems().length);

This piece of code does the trick... but I don't know where to put it. I literally put it at the end of every function in the controller but when i test, the result is wrong.

 

Example: I have two elements in the master, the first element's table has 4 rows and the second has 0. Both tabs show 0 as their count. When I used a console log, here's what I get (I put the log at the end of every function in the controller. The number on the left is the number of elements in the table) :

 

When the app first starts, the first master element is is selected.

 

0 getEventBus
0 getRouter
0 onInit
0 onRouteMatched
0 onRouteMatched
0 getEventBus
0 fireDetailChanged
0 fireDetailChanged
0 getEventBus
0 onMasterLoaded

When I select the second element in the master:

 

4 onRouteMatched
4 getEventBus
4 fireDetailChanged
4 fireDetailChanged
0 getEventBus
0 onRouteMatched

When I go back to selecting the first element in the master:

 

0 onRouteMatched
0 getEventBus
0 fireDetailChanged
0 fireDetailChanged
0 getEventBus
0 onRouteMatched

Viewing all articles
Browse latest Browse all 1804

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>