Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

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

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.

Former Member
Former Member replied

Resolved using bindAggregation method.

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

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

0 View this answer in context

Helpful Answer

by
Not what you were looking for? View more on this topic or Ask a question