Skip to Content
0
Jul 26, 2018 at 09:08 AM

Problem with mock data in WEB IDE

135 Views Last edit May 24, 2020 at 11:50 AM 2 rev

Hello,

I have problems with mockdata. My question is similar to this page (https://archive.sap.com/discussions/thread/3761243). However, my source code doesn't exist "/".

I created an app based on this page (https://sapui5.hana.ondemand.com/#/sample/sap.ui.core.tutorial.mockserver.02/preview).

I created an own metadata file and added some mock data with "json files". When I run with the mock data in the json files, the master property transforms all my entries in the last one .

I put here my source codes and screen shots.

P.S) If this problem resolved, I will want to create application using "split app". So, my source codes use "semantic: masterPage".

Please help me.

Kind Regards,

Taiki

Meetups.json

[{
	"bpID": "001",
	"bpname": "bpname1",
	"__metadata": {
		"uri": "Meetups(undefined)",
		"type": "NerdMeetup.Models.Meetup"
	}
}, {
	"bpID": "002",
	"bpname": "bpname2",
	"__metadata": {
		"uri": "Meetups(undefined)",
		"type": "NerdMeetup.Models.Meetup"
	}
}, {
	"bpID": "003",
	"bpname": "bpname3",
	"__metadata": {
		"uri": "Meetups(undefined)",
		"type": "NerdMeetup.Models.Meetup"
	}
}]

metadata.xml

<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<edmx:Edmx Version="1.0"
    xmlns:edmx="http://schemas.microsoft.com/ado/2007/06/edmx"
    xmlns:sap="http://www.sap.com/Protocols/SAPData">
    <edmx:DataServices
        xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata" m:DataServiceVersion="1.0">
        <Schema Namespace="NerdMeetup.Models"
            xmlns:d="http://schemas.microsoft.com/ado/2007/08/dataservices"
            xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata"
            xmlns="http://schemas.microsoft.com/ado/2006/04/edm">
            <EntityType Name="Meetup">
            	<key>
            		<PropertyRef name="bpID"/>
            	</key>
                <Property Name="bpID" Type="Edm.String" Nullable="true" MaxLength="3" />
                <Property Name="bpname" Type="Edm.String" Nullable="true" MaxLength="20" />
            </EntityType>
            <ComplexType Name="LocationDetail" />
            <EntityContainer Name="NerdMeetups" m:IsDefaultEntityContainer="true">
                <EntitySet Name="Meetups" EntityType="NerdMeetup.Models.Meetup" />
                <FunctionImport Name="FindUpcomingMeetups" EntitySet="Meetups" ReturnType="Collection(NerdMeetup.Models.Meetup)" m:HttpMethod="GET" />
                <EntitySet Name="Meets" EntityType="NerdMeetup.Models.Meetup2" />
                <FunctionImport Name="FindUpcomingMeetups" EntitySet="Meets" ReturnType="Collection(NerdMeetup.Models.Meetup2)" m:HttpMethod="GET" />
            </EntityContainer>
        </Schema>
    </edmx:DataServices>
</edmx:Edmx>

App.view.xml

<mvc:View controllerName="ZKST005.MockServer.controller.App" xmlns:core="sap.ui.core" xmlns:html="http://www.w3.org/1999/xhtml" xmlns:action="http://schemas.sap.com/sapui5/extension/sap.ui.core.CustomData/1"
	xmlns="sap.m" xmlns:mvc="sap.ui.core.mvc" xmlns:semantic="sap.m.semantic">
		<semantic:MasterPage
		id="page"
		title="{i18n>headerText}">
			<semantic:subHeader>
			<Bar id="headerBar">
				<contentMiddle>
					<SearchField
						id="searchField"
						width="100%"
						search="onSearch">
					</SearchField>
				</contentMiddle>
			</Bar>
		</semantic:subHeader>
		
		<semantic:content>
			<List headerText="{i18n>headerText}" id="list" items="{/Meetups}" noDataText="{i18n>noDataText}" mode="SingleSelectMaster"
				selectionChange="onSelectionChange">
				<items>
					<ObjectListItem title="{bpID}" type="Active" press="onSelectionChange">
					</ObjectListItem>
				</items>
			</List>
		</semantic:content>
			
		</semantic:MasterPage>
</mvc:View>

Attachments

list-view.png (40.0 kB)