Skip to Content
avatar image
Former Member

How to bind a timestamp in sap.m.Table

Hi all,

I've problems binding a timestamp to a column in my sap.m.Table view.

I am getting tasks from a web rest api as json response. Each task has an creation date.

I am using JS Views.

var oTableActive = new sap.m.Table({
columns:
[ 
				new sap.m.Column({ header: new sap.m.Label({ text: "Name" }) }), 
				new sap.m.Column({header: new sap.m.Label({text: "Description"}) }),
				new sap.m.Column({header: new sap.m.Label({text: "Due Date"}) })
			],
			cellClick: [oController.onCellClicked, oController]
});

var oTempActive = new sap.m.ColumnListItem({
cells:[ 
    new sap.m.Text({ text:"{tasksActive>name}" }),
    new sap.m.Text({ text:"{tasksActive>description}" }),
    new sap.m.DatePicker(
				{ 
					editable: false, 
					value:"{tasksActive>dueDate}", 
					valueFormat: "ss", displayFormat: "dd.MM.yyyy",
				})

			]
		});
oTableActive.bindItems({
			path: "tasksActive>/data",
			template: oTempActive
		});

Example of the timestamp: 1493762399000

Can anybody please explain how I can bind the timestamp and use a custom displayFormat.

thanks

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

3 Answers

  • Apr 26, 2017 at 03:52 PM
    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Apr 27, 2017 at 08:11 AM

    Thanks for your reply.
    Unfortunately I am not sure, how the article can help me.

    I would like to bind directly a JSON String to a table column. As far as I understood binding, I do not have the chance to use the formatters.
    I was hoping that I can pass the timestamp to the sap.m.DatePicker and properly set the valueFormat and displayFormat.

    Add comment
    10|10000 characters needed characters exceeded

  • Apr 27, 2017 at 10:11 AM

    You can convert the time stamp into string and attach to the text control of the table if you just want to view the time stamp but if you want to edit the timestamp than use dateTimePicker control

    thanks

    Viplove

    Add comment
    10|10000 characters needed characters exceeded