cancel
Showing results for 
Search instead for 
Did you mean: 

How to show two different JSON models data in same UI5 Page

Former Member
0 Kudos

Hi Friends,

I have two different JSON models one is Header and another one is Item details, right now there is no relationship between two models.

I Created an UI page using XML format. In UI page There is two components 1) List 2) Table. I need to bind the Header data into List, Item details data in Table. How to bind the data to UI?

I try to bind the data using "items" attribute, but always showing Headers data only. What is the syntax to specific JSON to binding the data to specific UI component?

XML Layout :


<List  items="{/results}" > ....... </List>

<Table items="{/results}" noDataText="Details Not Available"></Table>

JSON Objects :


var headerModel= new sap.ui.model.json.JSONModel();

sap.ui.getCore().setModel(headerModel, "oHeaderDataModel");

var detailsModel= new sap.ui.model.json.JSONModel();

sap.ui.getCore().setModel(detailsModel, "oDetailsDataModel");

Before Navigating to Target View I'm setting headerModel to View.


var view2 = sap.ui.getCore().byId('TargetView');

view2.setModel(headerModel);

How to specify the "oHeaderDataModel" to List View as well as "oDetailsDataModel" to Table.

Thanks in Advance,

Venu.

View Entire Topic
Former Member

Resolved using bindAggregation method.


this.getView().byId("TableID").bindAggregation("items", "/results", id_tbl_row);

this.getView().byId("TableID").setModel(oDetailsDataModel);