Skip to Content
0
Former Member
Jun 17, 2015 at 07:03 PM

Date issue in dialogue thats calling view controller

19 Views

Hi All,

I am trying to modify date format in a dialogue that is being called from view. following is the code from view and controller.

toolbar: new sap.ui.commons.Toolbar({

items: [

new sap.ui.commons.Button('edit_btn',{

text: "Edit Note",

icon: "sap-icon://edit",

enabled: false,

press: oController.editNotePress.bind(oController)

}),

Code from Controller:

var fileTable = sap.ui.getCore().byId('noteFileTable');

var json = JSON.parse(fileTable.getModel().getJSON());

for (var i = 0; i < indices.length; i++) {

var context = searchTable.getContextByIndex(indices[i]).getPath();

var model = searchTable.getModel();

var obj = model.getProperty(context);

obj.__metadata = null;

if (!doFilesContainFile(json.results, obj)) {

json.results.push(obj);

}

}

fileTable.getModel().setData(json);

fileTable.bindRows("/results");

addTableColumn(fileTable, "ACTIVATED_AT", "Activated at");

All I need to do is to modify "Activated at" field to display in format "yyyy-MM-dd HH:mm:ss.ms"

I have used date formatter at another place but its not working here. When I tried following code, the popup is not getting displayed.

addTableColumn(new sap.ui.table.Column({

label: new sap.ui.commons.Label({

text: "Activated at"

}),

//Date modification

template: new sap.ui.commons.TextView().bindProperty("text", {

path: 'ACTIVATED_AT',

type: new sap.ui.model.type.Date({pattern:"yyyy-MM-dd HH:mm:ss.ms"})

})

}));

Any help would be much appreciated.

Regards

Uday