Created
August 23, 2014 17:57
-
-
Save dennisseah/430167e616ffa0cc4879 to your computer and use it in GitHub Desktop.
SAPUI5: Enable or Disable editing of cell in sap.ui.table.Table
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" | |
data-sap-ui-libs="sap.ui.table,sap.ui.commons" | |
data-sap-ui-theme="sap_bluecrystal" | |
src="https://sapui5.hana.ondemand.com/resources/sap-ui-core.js"> | |
</script> | |
<script> | |
jQuery(function() { | |
var aData = [ | |
{name: "Dente", company: "http://www.sap.com", status: true}, | |
{name: "Friese", company: "Google", status: true}, | |
{name: "Mann", company: "http://www.sap.com", status: false}, | |
{name: "Schutt", company: "SAP", status: true} | |
]; | |
var oTable = new sap.ui.table.Table({ | |
width: '400px', | |
selectionMode: sap.ui.table.SelectionMode.None | |
}); | |
oTable.addColumn(new sap.ui.table.Column({ | |
label: new sap.ui.commons.Label({text: "Name"}), | |
template: new sap.ui.commons.TextField({ | |
value:"{name}", | |
enabled: '{status}' | |
}) | |
})); | |
oTable.addColumn(new sap.ui.table.Column({ | |
label: new sap.ui.commons.Label({text: "Company"}), | |
template: new sap.ui.commons.TextField({ | |
value: "{company}", | |
enabled: '{status}' | |
}) | |
})); | |
var oModel = new sap.ui.model.json.JSONModel(); | |
oModel.setData(aData); | |
oTable.setModel(oModel); | |
oTable.bindRows("/"); | |
oTable.placeAt("content"); | |
}); | |
</script> | |
</head> | |
<body class="sapUiBody"> | |
<div id="content"></div> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment