on 04-24-2018 7:59 PM
Hi experts.
I'm relatively new in SAPUI5.
What I want to do is a timeline with data binding from a OData.
I have this:
var cnURI = "/sap/opu/odata/sap/ZSPORTAL_NOTICE_CRUD01_SRV/";
var oNotices = new sap.ui.model.odata.ODataModel(cnURI, false, "jdiaz", "sineti.01");
var oONotices = new sap.ui.model.json.JSONModel();
oNotices.read("/znoticeSet", undefined, undefined, false,
function(oData, response) { oONotices.setData(oData);});
this.getOwnerComponent().setModel(oONotices,"notice");
var oItem = new sap.suite.ui.commons.TimelineItem({
dateTime: "{notice>Fecha}" ,
text: "{notice>Head}" ,
userName: {notice>Subhead}",
userPicture: "resources/2018-03-13_12-04-04.jpg", title: "" ,
icon: "sap-icon://edit",
filterValue: "Filter Value",
userNameClickable: true
});
var oTimeline = new sap.suite.ui.commons.Timeline({
alignment: "Left" ,
enableDoubleSided: false ,
axisOrientation: "Vertical",
width: "596.9921875px",
height: "270.7421875px",
enableBusyIndicator: true,
enableScroll: false,
forceGrowing: true,
groupBy: "",
growingThreshold: 1,
showHeaderBar: true,
showIcons: true,
showSearch: true,
sort: true,
sortOldestFirst: false
});
oTimeline.bindAggregation("content", {
path: "notice>/results",
template: oItem
});
oTimeline.setModel(oONotices);
But I get this as my result:
As you can see the dialog with the timeline is created, but I don't get it why this remains empty.
I hope you can help me.
Best Regards!
Hi Juan,
Could you please check if the following code answers your question.
I believe you need to place a function formatter on the dateTime field to convert the odata date (which comes as a string) into a Date javascript object.
You could take a look at the sample for the Timeline with Odata, but it is based on xmlview and you are using javascript. I would recommend you to use xmlview instead of javascript. It is easier to use and maintain than plain js views. But it is up to you to make the switch.
Unfortunately, the sample is based on the Northwind Odata service, and it is not currently working. So you will need to tweak a little to see it working on your own server.
Regards,
Ivan
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
92 | |
11 | |
10 | |
9 | |
9 | |
7 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.