May 18 2016
SAP HTML5 Open UI5 Fiori image link press click action event
<html>
<head>
<meta http-equiv=”X-UA-Compatible” content=”IE=edge” />
<meta http-equiv=”Content-Type” content=”text/html;charset=UTF-8″/>
<script src=”https://sapui5.hana.ondemand.com/resources/sap-ui-core.js”
id=”sap-ui-bootstrap”
data-sap-ui-libs=”sap.m,sap.ui.layout,sap.ui.commons”
data-sap-ui-theme=”sap_bluecrystal”
type=”text/javascript”>
</script>
</head>
<body class=”sapUiBody”>
<div id=”sample1″></div>
<div id=”sample2″></div>
<div id=”sample3″></div>
</body>
</html>
<script>
// creates a simple link with an action and property href not set
var oLink1 = new sap.ui.commons.Link({
text: “Bana Tıkla 1”,
tooltip: “Bu bir ui5 link örneğidir”,
press: function() {alert(‘Selam ‘ + oLink1.getText());}});
// attach the link to the DOM
oLink1.placeAt(“sample1”);
var oImage = new sap.ui.commons.Image();
oImage.setSrc(“http://www.sap.com/global/images/SAPLogo.gif”);
oImage.setAlt(“alternative image text for image”);
oImage.attachPress(function () {
alert(“karadere burhan logo”);
});
oImage.placeAt(“sample2”);
var ImageLink = new sap.ui.commons.Image({
src: “http://www.sap.com/global/images/SAPLogo.gif” ,
press: function() {
alert(‘imagelink’);
}
});
ImageLink.placeAt(“sample3”);
</script>
http://scn.sap.com/community/developer-center/front-end/blog/2015/06/13/ui5-programming-examples
Ersin
18 Mayıs 2016 @ 15:38
var aData = [
{name: “Test one”,surname:”11111″},
{name: “Another test”,surname:”2222″},
{name: “test”,surname:”333333333″},
{name: “fourth”,surname:”444444″},
{name: “fifth”,surname:”5555″},
];
var oTable = new sap.ui.table.Table({
editable: false,
columns: [
new sap.ui.table.Column({
template: new sap.ui.commons.Link({
text: “{name}”,
press : function(e) {
var model = this.getModel();
var path = e.getSource().getBindingContext().getPath();
var obj = model.getProperty(path);
console.log(obj.surname);
alert(obj.surname);
}
})
}),
new sap.ui.table.Column({
template:new sap.ui.commons.Link({
text: “{surname}”,
})
})
]
});
oTable.placeAt(“uiArea”);
var oModel = new sap.ui.model.json.JSONModel();
oModel.setData(aData);
oTable.setModel(oModel);
oTable.bindRows(“/”);
var oButton = new sap.ui.commons.Button({
text: “TestButton”,
press: function() {
console.log(“——————————-“);
console.log(“Indices: ” + oTable.getSelectedIndices());
var rows = oTable.getRows();
console.log(“Rows: ” + rows.length);
for (var i = 0; i < rows.length; i++) {
// console.log(rows[i].getCells()[0].mProperties.text);
}
}
});
oButton.placeAt("uiArea");