Skip to Content

How can I get a corect timeline data binding in sapui5

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();"/znoticeSet", undefined, undefined, false,
	function(oData, response) {	oONotices.setData(oData);});
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

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!

nodata.png (10.0 kB)
Add comment
10|10000 characters needed characters exceeded

  • are you able to read the notice>Fecha before binding the items the aggregation?

    aggregation to me sounds like a list of records.... and that is probably why you are not getting "notice>Fecha" single value??

  • Follow
  • Get RSS Feed

1 Answer

  • Apr 26, 2018 at 05:29 PM

    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.


    Add comment
    10|10000 characters needed characters exceeded