cancel
Showing results for 
Search instead for 
Did you mean: 

Bind and display Collection(Edm.String)

szymon_glapiak
Explorer

Hi team. I'm wondering how to bind Complex type - Collection(Edm.String- into List. Example:

Service (odata v4) https://services.odata.org/V4/TripPinServiceRW.

Entity Type :Person has property :

<Property Name="Emails" Type="Collection(Edm.String)"/>

I setup something like

	    <List  id="list0" items="{Emails}">
	        <items>
	            <StandardListItem title="{}"  id="item1"/>
	        </items>
	    </List>

Number of items is ok but the content of the title is not displayed . What should I put there ?

Accepted Solutions (0)

Answers (3)

Answers (3)

smarchesini
Active Contributor

Hi Szymon,

for me it's work.

This is my code.

Controller:

sap.ui.define([
	'jquery.sap.global',
	'sap/ui/core/mvc/Controller',
	'sap/ui/model/json/JSONModel'
], function (jQuery, Controller, JSONModel) {
	"use strict";


	var ListController = Controller.extend("sap.m.sample.ListCounter.List", {


		onInit: function (evt) {
			// set explored app's demo model on this sample
			var email = {
				email: ["sebastiano@mail.com", "marchesini@mail.com"]
			};
			var oModel = new JSONModel(email);
			this.getView().setModel(oModel);
		}
	});


	return ListController;


});

view :

  <mvc:View controllerName="sap.m.sample.ListCounter.List" xmlns:mvc="sap.ui.core.mvc" xmlns="sap.m">
	<List headerText="Products" items="{ path: '/email' }">
		<StandardListItem id="item1" title="{}"/>
	</List>
</mvc:View>


The result:

Regards,
Sebastiano

venkateswaran_k
Active Contributor
0 Kudos

Hi

You may have to specify the path explicitly.

<List headerText="Persons" items="{ path: '/Emails'}" >

<StandardListItem title="{Email}" />

</List>

Regards,

Venkat

szymon_glapiak
Explorer
0 Kudos

Thank For you feedback but in my example I used odata V4 as the model with its metadata. I agree with You that for JSON model it is working .