Skip to Content

Template Setting Formatting SAPUI5

Jan 23 at 04:47 AM


avatar image

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}"
 //this does not work
new sap.m.CheckBox({
select: function(){
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}"
10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

1 Answer

Irfan Gokak Jan 23 at 08:57 AM


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

10 |10000 characters needed characters left characters exceeded