sap.ui.define(
["sap/ui/core/Control", "sap/m/GenericTile"],
function(Control, GenericTile) {
"use strict";
var CustomGenericTile = GenericTile.extend("b.customcontrol.CustomGenericTile", {
metadata: {
library: "sap.m",
properties: {
firstName: {
type: "string",
group: "Misc",
defaultValue: null
},
companyName: {
type: "string",
group: "Misc",
defaultValue: null
},
footer: {
type: "string",
group: "Misc",
defaultValue: null
},
footerColor: {
type: "sap.m.ValueColor",
group: "Misc",
defaultValue: null
},
unit: {
type: "string",
group: "Misc",
defaultValue: null
},
disabled: {
type: "boolean",
group: "Misc",
defaultValue: null
},
frameTypeFooter: {
type: "sap.m.FrameType",
group: "Misc",
defaultValue: null
}
}
}
});
CustomGenericTile.prototype.generateUUID = function() {
var d = new Date().getTime();
var uuid = "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, function(c) {
var r = (d + Math.random() * 16) % 16 | 0;
d = Math.floor(d / 16);
return (c === "x" ? r : (r & 0x3 | 0x8)).toString(16);
});
return uuid;
};
CustomGenericTile.prototype.setFooter = function(footer) {
return this.setProperty("footer", footer);
};
CustomGenericTile.prototype.setFooterColor = function(footerColor) {
return this.setProperty("footerColor", footerColor);
};
CustomGenericTile.prototype.setUnit = function(unit) {
return this.setProperty("unit", unit);
};
CustomGenericTile.prototype.setDisabled = function(disabled) {
return this.setProperty("disabled", disabled);
};
CustomGenericTile.prototype.setFirstName = function(firstName) {
return this.setProperty("firstName", firstName);
};
CustomGenericTile.prototype.setCompanyName = function(companyName) {
return this.setProperty("companyName", companyName);
};
CustomGenericTile.prototype.setFrameTypeFooter = function(frameTypeFooter) {
return this.setProperty("frameTypeFooter", frameTypeFooter);
};
return CustomGenericTile;
});
sap.ui.define(["sap/ui/core/Renderer", "sap/m/Label", "sap/m/GenericTile", "sap/m/TileContent", "sap/ui/layout/VerticalLayout"],
function(Renderer, Label, GenericTile, TileContent, VerticalLayout) {
"use strict";
var CustomGenericTileRenderer = Renderer.extend("b.customcontrol.CustomGenericTileRenderer", {
render: function(oRm, oControl) {
this.renderPreamble(oRm, oControl);
// implementation core renderer logic here
var id = oControl.getId();
/*Retrive Data From UI */
/*Retrive data for cutom property*/
var sFirstName = oControl.getFirstName();
var sCompanyName = oControl.getCompanyName();
/*Retrive data for inheritance property*/
var sHeader = oControl.getHeader();
var sFrameType = oControl.getFrameType();
var oHeaderImage = oControl.getHeaderImage();
var sState = oControl.getState();
var sUnit = oControl.getUnit();
var sFooter = oControl.getFooter();
var sSubheader = oControl.getSubheader();
var oFooterColor = oControl.getFooterColor();
var bDisabled = oControl.getDisabled();
var oFrameTypeFooter = oControl.getFrameTypeFooter();
oRm.write("<div");
oRm.writeControlData(oControl);
oRm.writeAttribute("id", id + "-CustomGenericTile");
oRm.writeAttribute("role", "presentation");
oRm.write(">");
var oGenericTile = new GenericTile(id + "-" + oControl.generateUUID(), {
header: sHeader,
headerImage: oHeaderImage,
frameType: sFrameType,
state:sState,
subheader:sSubheader
});
// oGenericTile.addStyleClass("widthGeneric");
var oTileContent = new TileContent(id + "-TileContent" + oControl.generateUUID(),{
unit: sUnit,
footer:sFooter,
footerColor:oFooterColor,
disabled : bDisabled,
frameType : oFrameTypeFooter
});
var oVerticalLayout = new VerticalLayout(id + "-VerticalLayout" + oControl.generateUUID());
var oLabelFirstName = new Label(id + "-LabelFirstName" + oControl.generateUUID(), {
text: sFirstName
});
var oLabelCompanyName = new Label(id + "-LabelCompanyName" + oControl.generateUUID(), {
text: sCompanyName
});
oVerticalLayout.addContent(oLabelFirstName);
oVerticalLayout.addContent(oLabelCompanyName);
oTileContent.setContent(oVerticalLayout);
oGenericTile.addTileContent(oTileContent);
oRm.renderControl(oGenericTile);
oRm.write("</div>");
this.renderPostamble(oRm, oControl);
},
renderPreamble: function(oRm, oControl) {
},
renderPostamble: function(oRm, oControl) {
}
});
return CustomGenericTileRenderer;
});
var oModelGenericTile = new JSONModel({});
var oGenericData = {
"genericData":[
{
"firstName" : "Biplab Ray",
"companyName": "TCS",
"header" : "TATA Consultancy Services Pvt Ltd",
"headerImage": "sap-icon://begin",
"frameType":"OneByOne",
"unit" : "unit",
"footer":"footer"
},
{
"firstName" : "Biplab Ray1",
"companyName": "IBM",
"header" : "Internation Business Machine Global Business",
"headerImage": "sap-icon://begin",
"frameType":"OneByOne",
"unit" : "unitOne",
"footer":"footerOne",
"state":"Loading"
},
{
"firstName" : "Biplab Ray2",
"companyName": "E&Y",
"header" : "E&Y",
"headerImage": "sap-icon://compare",
"frameType":"OneByOne",
"unit" : "unitOne",
"footer":"footerOne",
"state":"Failed"
},
{
"firstName" : "Biplab Ray3",
"companyName": "SAP",
"header" : "SAP LLP",
"headerImage": "sap-icon://begin",
"frameType":"OneByOne",
"unit" : "unitOne",
"footer":"footerOne",
"state":"Failed"
},
{
"firstName" : "Biplab Ray4",
"companyName": "SAP Budapest",
"header" : "SAP LLP Hungary",
"headerImage": "sap-icon://compare",
"frameType":"TwoByOne",
"unit" : "unitOne",
"footer":"footerOne"
},
{
"firstName" : "Biplab Ray5",
"companyName": "IBM Bratislava",
"header" : "IBM Brtislava Inc",
"headerImage": "sap-icon://begin",
"frameType":"TwoByOne",
"unit" : "unitOne",
"footer":"footerOne",
"state":"Loading"
}
]
};
oModelGenericTile.setData(oGenericData);
this.setModel(oModelGenericTile, "oModelGenericTile");
<mvc:View controllerName="b.controller.businesscontroller.Wizard" xmlns:l="sap.ui.layout" xmlns:c="b.customcontrol"
xmlns:mvc="sap.ui.core.mvc" xmlns:core="sap.ui.core" xmlns="sap.m">
<List items="{oModelGenericTile>/genericData}" growing="true" growingThreshold="2" growingTriggerText="More">
<CustomListItem class="sapMLIBCustom">
<c:CustomGenericTile firstName="{oModelGenericTile>firstName}" companyName="{oModelGenericTile>companyName}" header="{oModelGenericTile>header}"
headerImage="{oModelGenericTile>headerImage}" frameType="{oModelGenericTile>frameType}" unit="{oModelGenericTile>unit}"
footer="{oModelGenericTile>footer}" state="{oModelGenericTile>state}"></c:CustomGenericTile>
</CustomListItem>
</List>
</mvc:View>
.sapMLIBCustom {
display: -webkit-box;
display: inline-flex !important;
-webkit-box-align: center;
align-items: center;
position: relative;
background: #ffffff;
border-bottom: 1px solid #e5e5e5;
/*padding: 0 1rem 0 1rem;*/
}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
14 | |
10 | |
8 | |
7 | |
4 | |
4 | |
4 | |
4 | |
3 |