Skip to Content
0

How to bind a timestamp in sap.m.Table

Apr 26, 2017 at 03:34 PM

69

avatar image
Former Member

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

10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

3 Answers

Jun Wu Apr 26, 2017 at 03:52 PM
0
Share
10 |10000 characters needed characters left characters exceeded
avatar image
Former Member Apr 27, 2017 at 08:11 AM
0

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.

Show 1 Share
10 |10000 characters needed characters left characters exceeded

it is just a plain string. you have to parse it.

0
VIPLOVE KHUSHALANI Apr 27, 2017 at 10:11 AM
0

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

Share
10 |10000 characters needed characters left characters exceeded