You are on page 1of 5

sap.ui.jsview("sapfiestadubaara.

events", {
/** Specifies the Controller belonging to this View.
* In the case that it is not implemented, or that "null" is returned, th
is View does not have a Controller.
* @memberOf sapfiestadubaara.events
*/
getControllerName : function() {
return "sapfiestadubaara.events";
},
/** Is initially called once after the Controller has been instantiated.
It is the place where the UI is constructed.
* Since the Controller is given to this method, its event handlers can b
e attached right away.
* @memberOf sapfiestadubaara.events
*/
createContent : function(oController) {
var oRowTemplate_NoViews = new sap.ui.commons.layout.VerticalLay
out({
width:
{
path:"following",
formatter: function(v)
{
if(v>0){this.addStyleClass("following");return "
150px";}
else {this.addStyleClass("notfollowing");return
"150px";}
}
}
});
oRowTemplate_NoViews.addStyleClass("following");
var control,control_event_name,control_event_image,control_eve
nt_location,control_event_time;
//eventname Label
control_event_name = new sap.ui.commons.Label();
control_event_name.bindProperty("text","eventName");

//image
control_event_image = new sap.ui.commons.Image({src:"{eventImgPath}"});
control_event_image.setHeight("100px");
control_event_image.setWidth("100px");
control_event_image.addStyleClass("image");

//event location field


var a="images/FiestaIcon_map.png";
control_event_location = new sap.ui.commons.Label({textAlign: sap.ui.co
re.TextAlign.Left,

icon:
{
path:"following",
formatter: function(v)
{
if(v>0){this.addStyleClass("followinglnt");return a;}
else {this.addStyleClass("notfollowinglnt");return a;}
}
}
});
control_event_location.bindProperty("text","location");
//control_event_location.addStyleClass("followinglnt");

//event time field


z="images/FiestaIcon_calendar.png";
control_event_time = new sap.ui.commons.Label({textAlign: sap.ui.core.T
extAlign.Left,
icon:
{
path:"following",
formatter: function(v)
{
if(v>0){this.addStyleClass("followinglnt");return z;}
else {this.addStyleClass("notfollowinglnt");return z;}
}
}
});
control_event_time.bindProperty("text", {
parts: [
{path: "from_date", type: new sap.ui.model.type.String()},
{path: "to_date", type: new sap.ui.model.type.String()}
],
formatter: function(from_date, to_date){ // all parameters are stri
ngs
from_date = from_date || "";
to_date = to_date || "";

return from_date + " to " + to_date;


}
});
//control_event_time.addStyleClass("followinglnt");

var x="images/FiestaIcon_addsmall.png";
var y="images/FiestaIcon_tick.png";
var oButton2 = new sap.ui.commons.Button({
icon : {
path:"following",
formatter: function(v)
{
if(v>0){
this.addStyleClass("follimg");return y;}
else {th
is.addStyleClass("notfollimg");return x;}
}
},
styled:false,
});
/*x="follimg";y="notfollimg";
oButton2.addStyleClass({
path:"following",
formatter: function(v)
{
if(v>0)r
eturn y;
else ret
urn x;
}
});*/
oRowTemplate_NoViews.addContent(control_event_name);
oRowTemplate_NoViews.addContent(control_event_image);
oRowTemplate_NoViews.addContent(control_event_location);
oRowTemplate_NoViews.addContent(control_event_time);
//oRowTemplate_NoViews.addContent(control);
oRowTemplate_NoViews.addContent(oButton2);
var first_Tile= new sap.ui.commons.layout.VerticalLayout();
first_Tile.addStyleClass("following");
var add_label= new sap.ui.commons.Label({text:"ADD"});
first_Tile.addContent(add_label);

//////// End of TEMPLATE SECTION //////////////////////////////////////


/////////////////////
//////// CONTROL SECTION //////////////////////////////////////////////
/////////////////////

//
//create view repeater title (optional)
// create the row repeater control
var oViewRepeater_NoViews = new sap.suite.ui.commons.ViewRepeater({

noData: new sap.ui.commons.TextView({text: "Sorry, no data availabl


e!"}),
showViews: false, // disable view selector
showSearchField: false,
// showMoreSteps: 10, // you can use 'Show More' feature instead of
paging
//set view properties directly to the repeater
responsive: true,
itemMinWidth: 150,
numberOfRows: 12, // view property NumberOfTiles has legacy name he
re
rows:
{
path: "/allEventsInfo",
template: oRowTemplate_NoViews
}
});
//oViewRepeater_NoViews.addStyleClass();
/*
oViewRepeater_NoViews.addView(new sap.suite.ui.commons.RepeaterViewConfigurati
on({
tooltip: "View with default name",
itemMinWidth: 150,
itemHeight: 170,
responsive: true,
path: "/allEventsInfo",
template: {
path:"/following",
formatter: function(v)
{
if(v==-1)return first_Tile;
else return oRowTemplate_NoViews;
}
} }));
*/
var final_Layout = new sap.ui.commons.layout.VerticalLayout({
content: [oViewRepeater_NoViews]
});
final_Layout.setWidth("650px");
return final_Layout;
//return oViewRepeater_NoViews;
}

});
/*{
path:"/following",
formatter: function(v)
{
if(v==-1){return first_Tile;}
else {return oRowTemplate_NoViews;}
}
}*/
/*rows:
{
path: "/allEventsInfo",
template: oRowTemplate_NoViews
}
*/
/*
*
*/
/*{path:"/following",
formatter: function(v)
{
if(v=="-1")
{
this.rows.path: "/allEventsInfo",
this.rows.template: first_Tile
}
else
{
path: "/allEventsInfo",
template: oRowTemplate_NoViews
}
}
}*/

You might also like