Skip to Content
0

Question regarding binding path syntax JSON

May 30, 2017 at 01:16 PM

54

avatar image

Hi experts,

i have a question regarding element binding in SAPUI5.

{
	"Equipments": [
		{
			"EquipmentNr": "Equipment 0000000001",
			"Messpunkte": [
					{
						"MesspunktNr": "01"
					},
					{
						"MesspunktNr": "02"
					},
					{
						"MesspunktNr": "03"
					}
				]
		},
...
}

I use SplitApp controll with two master views. The first displays all Equipments (EquipmentNr) and the second masterview should display the "Messpunkte" of the selected equipment. Routing with parameters to the second master view works. But in this view I am not able to display The Messpunkte of the equipment.

The MasterPage2.controller.js with the onInit function is correct i guess:

onInit: function () {
			var oRouter = sap.ui.core.UIComponent.getRouterFor(this);
			oRouter.getRoute("master").attachPatternMatched(this._onObjectMatched, this);
		},
		_onObjectMatched: function (oEvent) {
			this.getView().bindElement({
				path: "/Equipments/" + oEvent.getParameter("arguments").equiPath,
				model: "equi"
			});
		}

The code of the MasterPage2 looks like:

	<Page 
		id="page2" 
		title="Messpunkte zum Equipment" 
		icon="sap-icon://action"
		showNavButton="true"
		navButtonPress="onNavBack">
			<content>
			<!--	<ObjectHeader
					title="{equi>Messpunkte}"/> -->
				<List
				items="{equi>/Messpunkte}">
					<StandardListItem
					title="{MesspunktNr}" />
				</List>
			</content>
	</Page>

The commend out part leads to the output [object Object],[object Object],[object Object]

The List control displays "No data".

Is there anybody with a hint maybe?

Thanks and regards

Benjamin

10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

2 Answers

Best Answer
Benjamin Schmitz May 31, 2017 at 08:40 AM
0

I figured it out:

in the <items> aggregation of the <List> control I now use the <ObjectListItem> control and the title should look like:
title="{equi>MesspunktNr}"

I think it would also work with a StandardListItem but i didnt try.

Share
10 |10000 characters needed characters left characters exceeded
Sharath M G May 30, 2017 at 03:39 PM
0

Where are loading the model "equi" used in your binding? It should be done in the init.

Show 1 Share
10 |10000 characters needed characters left characters exceeded

It is done in the manifest.json.

The model loading is not the point. i get access to the model. But thanks anyway

0