Hi all !
I want to navigate to a split screen with a details, and i want to display the details on the split screen.
The navigation to the split screen works well but the details are not transmitted.
Someone can help me ?
Thanks.
Matt.
Code below.
// Worklist.controller.js
// My méthod for navigate
onPress: function (oEvt) {
this.getRouter().navTo("Detail", {
detailProductPath : oEvt.getSource().getBindingContext().getProperty("PostID")
});
},
// Detail.controller.js
sap.ui.define([
'sap/ui/demo/bulletinboard/controller/BaseController',
'sap/ui/model/json/JSONModel',
'sap/ui/demo/bulletinboard/model/formatter'
], function (BaseController, JSONModel, formatter) {
"use strict";
return BaseController.extend("sap.ui.demo.bulletinboard.controller.Detail", {
formatter: formatter,
onInit: function () {
var oViewModel = new JSONModel({
busy: false
});
this.getRouter().getRoute("detail").attachPatternMatched(this._onPostMatched, this);
this.setModel(oViewModel, "postView");
},
_onPostMatched: function (oEvent) {
var oViewModel = this.getModel("postView"),
oDataModel = this.getModel();
this.getView().bindElement({
path: "/Posts('" + oEvent.getParameter("arguments").postId + "')",
events: {
dataRequested: function () {
oDataModel.metadataLoaded().then(function () {
oViewModel.setProperty("/busy", true);
});
},
dataReceived: function () {
oViewModel.setProperty("/busy", false);
}
}
});
}
});
});
// Detail.view.xml
<mvc:View xmlns:core="sap.ui.core" xmlns:mvc="sap.ui.core.mvc" xmlns="sap.m" controllerName="sap.ui.demo.bulletinboard.controller.Detail"
xmlns:html="http://www.w3.org/1999/xhtml">
<App id="Detail">
<pages>
<Page >
<content>
<SlideTile class="sapUiTinyMarginTop">
<tiles>
<GenericTile
backgroundImage="{
path:'Category',
formatter: '.formatter.backgroundTilePostView'
}"
frameType="TwoByOne"
press="pressOnTileOne">
<tileContent>
<TileContent footer="Current date">
<content>
<NewsContent
contentText="Description : {Description}"
subheader="{
path:'Price',
formatter: '.formatter.financingPossibility'
}">
</NewsContent>
</content>
</TileContent>
</tileContent>
</GenericTile>
</tiles>
</SlideTile>
</content>
</Page>
</pages>
</App>
// manifest.json
"routing": {
"config": {
"routerClass": "sap.m.routing.Router",
"viewType": "XML",
"viewPath": "sap.ui.demo.bulletinboard.view",
"targetAggregation": "pages",
"async": true
},
"routes": [
{
"pattern": "",
"name": "home",
"view": "Home",
"targetAggregation": "pages",
"controlId": "app"
},
{
"pattern": "Worklist",
"name": "worklist",
"view": "Worklist",
"targetAggregation": "pages",
"controlId": "app"
},
{ "pattern": "Split",
"name": "Splitapp",
"view": "Splitapp",
"targetAggregation": "pages",
"controlId": "app",
"subroutes": [{"pattern": "Split",
"name": "Master",
"view": "Master",
"targetAggregation": "masterPages",
"targetControl": "splitapp",
"subroutes":[{
"pattern": "Split/{detailProductPath}", "name": "Detail",
"view": "Detail",
"targetAggregation": "detailPages"
}]
}]
}
]
}