Skip to Content
avatar image
Former Member

sapui5: bind odata with xml view in 2nd view

handler code in first controller:

// handle item selection
handleLineItemPress : function(evt){
//Create app object
var app = new sap.m.App({
initialPage : this.createId("idlecture1")

//Create detail page
var page = sap.ui.view({
id : this.createId("idlecture1"),
viewName : "zy_ws16_708_university_management.lecture",
type : sap.ui.core.mvc.ViewType.XML

//Pass data to detail page
var context = evt.getSource().getBindingContext();,{

//show detail page in app


2nd controller code:

onInit: function() {
//Instantiate Odata model
var serviceUrl = "/sap/opu/odata/sap/ZY_WS16_708_UM_SRV/";
oModel = new sap.ui.model.odata.v2.ODataModel(serviceUrl);

var view = this.getView();
onBeforeShow : function(evt){

2nd view code:

<core:View xmlns:core="sap.ui.core" xmlns:mvc="sap.ui.core.mvc" xmlns="sap.m" xmlns:f="sap.ui.layout.form"
controllerName="zy_ws16_708_university_management.lecture" xmlns:html="">
<Page title="Lecture" showNavButton="true" navButtonPress="onBack">
<VBox class= "sapUiSmallMargin">
<f:SimpleForm id="idlecture1" title="Update Lecture Details">
<f:content id="lectures11">
<Label text="Lecture ID"/>
<Text text="{Id}"/>

<Label text="Name"/>
<Text text="{Name}"/>

<Label text="Room Number"/>
<Text text="{RoomNumber}"/>

<Label text="Lecturer"/>
<Text text="{Lecturer}"/>

<Label text="Type"/>
<Text text="{myName}"/>

<Label text="Offered In"/>
<Text text="{OfferedIn}"/>

<Label text="Weekly Hours"/>
<Text text="{WeeklyHours}"/>

<Label text="Content"/>
<Text text="{Content}"/>

<Label text="Prerequisites"/>
<Text text="{Prerequisites}"/>

<Label text="Organisation"/>
<Text text="{Organisation}"/>

<Label text="Credits"/>
<Text text="{Credits}"/>

<Label text="Language of Instruction"/>
<Text text="{LanguageOfInstruction}"/>


Please help! and let me know if there is anything wrong!

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

0 Answers