cancel
Showing results for 
Search instead for 
Did you mean: 

Template Setting Formatting SAPUI5

0 Kudos

I created a template for a table on the controller that consist of some text cells that get oData but also a combo box and checkbox that had its own function, that is pretty lengthy, before creating the template. This template was originally on the XML side but had to move it to the controller side in order to filter the correct oData.

How can I add that function to the checkbox? Also, can I format the date/time to show only month like I had on the xml side?

    var oTemplate = new sap.m.ColumnListItem({
cells: [
new sap.m.Text({
text: "{ID}"
}),<br>
 //this does not work
new sap.m.CheckBox({
select: function(){
this.estimatePercentageSelect();}
}),<br>
new sap.m.ComboBox({
items: [new sap.ui.core.ListItem("cMonth", {
text: currentMonthName,
key: currentMonthName
}),
new sap.ui.core.ListItem("month1", {
text: monthName1,
key: monthName1
}),
new sap.ui.core.ListItem("month2", {
text: monthName2,
key: monthName2
}),
new sap.ui.core.ListItem("month3", {
text: monthName3,
key: monthName3
})]}),
new sap.m.Text({
text: "{INSTALL}"
}),
<br>//this formatting also does not work
new sap.m.Text({
text: "{DATE}"
/*,
type: "sap.ui.model.type.DateTime", 
formatOptions: "{pattern: 'MMM'}" */
}),
<br>new sap.m.Text({
text: "{DWN}"
}),
new sap.m.Text({
text: "{EST}"
}), 
     new sap.m.Text({
text: "{PLAN}"
})
]
});

Accepted Solutions (0)

Answers (1)

Answers (1)

irfan_gokak
Contributor
0 Kudos

Hi,

It's not required to do it from controller. Let it be in view itself.