1
我正在嘗試使用SAPUI5創建一個簡單的Fiori Like UI。我想實現Master1-> Master2-> Details Scenario。問題是當我從Master1導航到Master2時,沒有數據顯示。SAPUI5:從master1到master2的數據綁定
Master.view.xml
<core:View
\t controllerName="sap.ui.demo.myFiori.view.Master"
\t xmlns="sap.m"
\t xmlns:core="sap.ui.core" >
\t <Page
\t \t title="{i18n>MasterTitle}" >
\t \t <subHeader>
\t \t <Bar>
\t \t <contentLeft>
\t \t <SearchField
\t \t search="handleSearch"
\t \t width="100%">
\t \t </SearchField>
\t \t </contentLeft>
\t \t </Bar>
\t \t </subHeader>
\t \t <List
\t \t id="assemblyLines"
\t \t mode="{device>/listMode}"
\t \t select="handleListSelect"
\t \t items="{/MaterialCollection}" >
\t \t \t <StandardListItem
\t \t \t \t type="Navigation"
\t \t \t \t press="handleListItemPress"
\t \t \t \t title="{Code}"
\t \t \t \t description="{Desc}"/>
\t \t </List>
\t </Page>
</core:View>
Master2.view.xml
<core:View
\t controllerName="sap.ui.demo.myFiori.view.Schedule"
\t xmlns="sap.m"
\t xmlns:core="sap.ui.core" >
\t <Page
\t \t title="{i18n>ScheduleTitle}"
\t \t showNavButton="true"
\t \t navButtonPress="handleNavButtonPress" >
\t \t <subHeader>
\t \t <Bar>
\t \t <contentLeft>
\t \t <SearchField
\t \t search="handleSearch"
\t \t width="100%">
\t \t </SearchField>
\t \t </contentLeft>
\t \t </Bar>
\t \t </subHeader>
\t \t <List id="jobs" items="{LineItems}"
\t \t mode="{device>/listMode}">
\t \t <ObjectListItem
\t \t type="{device>/listItemType}"
\t \t \t \t press="handleListItemPress"
\t \t \t \t title="{Material}"
\t \t \t \t number="{OrderQty}">
\t \t <attributes>
\t \t <ObjectAttribute text="{
\t \t path: 'PriorityDate',
\t \t formatter: 'sap.ui.demo.myFiori.util.Formatter.date'}" />
\t \t </attributes>
\t \t </ObjectListItem>
\t \t </List>
\t </Page>
</core:View>
App.View.js
sap.ui.jsview("sap.ui.demo.myFiori.view.App", {
\t getControllerName: function() {
\t \t return "sap.ui.demo.myFiori.view.App";
\t },
\t
\t createContent: function (oController) {
\t \t
\t \t // to avoid scroll bars on desktop the root view must be set to block display
\t \t this.setDisplayBlock(true);
\t \t
\t \t // create app
\t \t this.app = new sap.m.SplitApp();
\t \t
\t \t // load the master page
\t \t var master = sap.ui.xmlview("Master", "sap.ui.demo.myFiori.view.Master");
\t \t master.getController().nav = this.getController();
\t \t this.app.addPage(master, true);
\t \t
\t \t var schedule = sap.ui.xmlview("Schedule", "sap.ui.demo.myFiori.view.Schedule");
\t \t schedule.getController().nav = this.getController();
\t \t this.app.addPage(schedule, true);
\t \t
\t \t //this.app.addMasterPage(master).addMasterPage(schedule);
\t \t
\t \t // load the empty page
\t \t var empty = sap.ui.xmlview("Empty", "sap.ui.demo.myFiori.view.Empty");
\t \t this.app.addPage(empty, false);
\t \t
\t \t // load the detail page
\t \t var jobDetails = sap.ui.xmlview("JobDetails", "sap.ui.demo.myFiori.view.JobDetails");
\t \t jobDetails.getController().nav = this.getController();
\t \t this.app.addPage(jobDetails, false);
\t \t
\t \t // done
\t \t return this.app;
\t }
});
感謝
你能後在控制檯得到的錯誤? – sakthi 2014-10-13 06:29:24
無法看到您發佈的代碼。發佈兩個控制器的代碼,否則無法提供幫助。 – cschuff 2014-10-16 07:08:29