Created
January 24, 2014 19:58
-
-
Save agudeloa/8605027 to your computer and use it in GitHub Desktop.
SLTReplication
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE HTML> | |
<html> | |
<head> | |
<meta http-equiv="X-UA-Compatible" content="IE=edge"> | |
<script id="sap-ui-bootstrap" type="text/javascript" | |
src="/sap/ui5/1/resources/sap-ui-core.js" | |
data-sap-ui-theme="sap_goldreflection" | |
data-sap-ui-libs="sap.ui.commons, sap.ui.table" > | |
</script> | |
<!-- add sap.ui.table,sap.ui.ux3 and/or other libraries to 'data-sap-ui-libs' if required --> | |
<style> | |
[data-colortypeA="blue"] { | |
background-color: #87CEEB !important; | |
} | |
[data-colortypeA="yellow"] { | |
background-color: yellow !important; | |
} | |
[data-colortypeA="default"] { | |
background-color: #f2f2f2 !important; | |
} | |
[data-colortypeS="yellow"] { | |
background-color: yellow !important; | |
} | |
[data-colortypeS="red"] { | |
background-color: red !important; | |
} | |
[data-colortypeS="default"] { | |
background-color: #f2f2f2 !important; | |
} | |
</style> | |
<script> | |
// workaround for Chrome scrollbar issue | |
if (!!sap.ui.Device.browser.webkit && !document.width) { | |
jQuery.sap.require("sap.ui.core.ScrollBar"); | |
var fnOrg = sap.ui.core.ScrollBar.prototype.onAfterRendering; | |
sap.ui.core.ScrollBar.prototype.onAfterRendering = function() { | |
document.width = window.outerWidth; | |
fnOrg.apply(this, arguments); | |
document.width = undefined; | |
}; | |
} | |
var oHadTable = new sap.ui.table.Table({editable:true}); | |
var oControlStatus = new sap.ui.commons.TextView({text:"{TABLE/STATUS}"}); // short binding notation | |
var oControlAction = new sap.ui.commons.TextView({text:"{TABLE/ACTION}"}); // short binding notation | |
// create a CustomData template, set its key to "colortypeS" and "colortypeA" and bind its value to the colortypeS and colortypea data | |
var oDataTemplateS = new sap.ui.core.CustomData({key:"colortypeS", writeToDom:true}); | |
var oDataTemplateA = new sap.ui.core.CustomData({key:"colortypeA", writeToDom:true}); | |
replication = 'false'; | |
oDataTemplateS.bindProperty("value", "TABLE/STATUS", function(cellValue){ | |
switch (cellValue) { | |
case 'Error': | |
//reset replication to false | |
replication = 'false'; | |
return('red'); | |
case 'Executed': | |
if (replication==='true') | |
{ | |
//reset replication to false | |
replication = 'false'; | |
return('yellow'); | |
} | |
else | |
{ | |
return('default'); | |
} | |
case 'In Process': | |
//reset replication to false | |
replication = 'false'; | |
return('default'); | |
case 'Unknown': | |
return('default'); | |
case null: | |
return('default'); | |
default: | |
return('default'); | |
} | |
}); | |
oDataTemplateA.bindProperty("value", "TABLE/ACTION", function(cellValue){ | |
switch (cellValue) { | |
case 'Suspend': | |
return('blue'); | |
case 'Replication': | |
replication = 'true'; | |
return('default'); | |
case 'Unknown': | |
return('default'); | |
case null: | |
return('default'); | |
default: | |
return('default'); | |
} | |
}); | |
// add the CustomData template to the item template | |
oControlAction.addCustomData(oDataTemplateA); | |
oControlStatus.addCustomData(oDataTemplateS); | |
oHadTable.addColumn(new sap.ui.table.Column({label: new sap.ui.commons.Label({text: "SOURCE"}), template: new sap.ui.commons.TextView().bindProperty("text", "TABLE/SOURCE"), sortProperty: "TABLE/SOURCE", filterProperty: "TABLE/SOURCE"})); | |
oHadTable.addColumn(new sap.ui.table.Column({label: new sap.ui.commons.Label({text: "TARGET"}), template: new sap.ui.commons.TextView().bindProperty("text", "TABLE/TARGET"), sortProperty: "TABLE/TARGET", filterProperty: "TABLE/TARGET"})); | |
oHadTable.addColumn(new sap.ui.table.Column({label: new sap.ui.commons.Label({text: "TABLE_NAME"}), template: new sap.ui.commons.TextView().bindProperty("text", "TABLE/TABLE_NAME"), sortProperty: "TABLE/TABLE_NAME", filterProperty: "TABLE/TABLE_NAME" })); | |
oHadTable.addColumn(new sap.ui.table.Column({label: new sap.ui.commons.Label({text: "ACTION"}), template: oControlAction, sortProperty: "TABLE/ACTION", filterProperty: "TABLE/ACTION"})); | |
oHadTable.addColumn(new sap.ui.table.Column({label: new sap.ui.commons.Label({text: "STATUS"}), template: oControlStatus, sortProperty: "TABLE/STATUS", filterProperty: "TABLE/STATUS"})); | |
var aData = | |
{"TABLES":[ | |
{"TABLE":{"SOURCE":"DEV","TARGET":"sapdev01a_DEV_10","TABLE_NAME":"DD08L","ACTION":"Replication","STATUS":"Error"}}, | |
{"TABLE":{"SOURCE":"DEV","TARGET":"sapdev01a_DEV_10","TABLE_NAME":"MDTB","ACTION":"Replication","STATUS":"Executed"}}, | |
{"TABLE":{"SOURCE":"DEV","TARGET":"sapdev01a_DEV_10","TABLE_NAME":"RESB","ACTION":"Suspend","STATUS":"Executed"}}, | |
{"TABLE":{"SOURCE":"DEV","TARGET":"sapdev01a_DEV_10","TABLE_NAME":"RESB","ACTION":"Replication","STATUS":"In Process"}}, | |
{"TABLE":{"SOURCE":"DEV","TARGET":"sapdev01a_DEV_10","TABLE_NAME":"ADR6","ACTION":"Replication","STATUS":"In Process"}}, | |
{"TABLE":{"SOURCE":"DEV","TARGET":"sapdev01a_DEV_10","TABLE_NAME":"ADRC","ACTION":"Replication","STATUS":"In Process"}}, | |
{"TABLE":{"SOURCE":"DEV","TARGET":"sapdev01a_DEV_10","TABLE_NAME":"ADRP","ACTION":"Replication","STATUS":"In Process"}}, | |
{"TABLE":{"SOURCE":"DEV","TARGET":"sapdev01a_DEV_10","TABLE_NAME":"AFFW","ACTION":"Replication","STATUS":"In Process"}}, | |
{"TABLE":{"SOURCE":"DEV","TARGET":"sapdev01a_DEV_10","TABLE_NAME":"AMPL","ACTION":"Replication","STATUS":"In Process"}}, | |
{"TABLE":{"SOURCE":"DEV","TARGET":"sapdev01a_DEV_10","TABLE_NAME":"AUSP","ACTION":"Replication","STATUS":"In Process"}}, | |
{"TABLE":{"SOURCE":"DEV","TARGET":"sapdev01a_DEV_10","TABLE_NAME":"BKPF","ACTION":"Replication","STATUS":"In Process"}}, | |
{"TABLE":{"SOURCE":"DEV","TARGET":"sapdev01a_DEV_10","TABLE_NAME":"BSAD","ACTION":"Replication","STATUS":"In Process"}}, | |
{"TABLE":{"SOURCE":"DEV","TARGET":"sapdev01a_DEV_10","TABLE_NAME":"BSAK","ACTION":"Replication","STATUS":"In Process"}}, | |
{"TABLE":{"SOURCE":"DEV","TARGET":"sapdev01a_DEV_10","TABLE_NAME":"T009B","ACTION":"Replication","STATUS":"In Process"}}]} | |
; | |
//create the model | |
var oModel = new sap.ui.model.json.JSONModel(); | |
oModel.setData(aData); | |
//set the model to the core | |
oHadTable.setModel(oModel); | |
oHadTable.bindRows("/TABLES"); | |
oHadTable.placeAt("content"); | |
</script> | |
</head> | |
<body class="sapUiBody" role="application"> | |
<div id="content"></div> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment