Skip to Content
Former Member
Jan 30, 2017 at 12:58 PM

How to make the cells of a sap.ui.table.Table editable ?

143 Views Last edit Jan 30, 2017 at 12:59 PM 2 rev

Hi experts,

I am developing a SAP UI5 application.

I need to make the second column of the table as editable , but not in all the rows.

For example : if table has 5 rows , then second and fourth row has to be editable.The column is fixed (second column but the row may vary depending upon the value from odata ) We have a field for Editable in ODATA and the value is set as either true or false.



var oPriceProcedureTable = new sap.ui.table.Table({
	id: "table-price",
	editable: false,
	selectionMode: sap.ui.table.SelectionMode.Single

oView.getModel().read("/PriceSet", {
	success: function(oData) {

		var priceData = oData.results;

		var Staic_Feilds = [{
			"Fieldname": "Material",
			"Edit": false,
			"ScrtextS": "Material Number"
		}, {
			"Fieldname": "Price",
			"Edit": true,
			"ScrtextS": "Unit Price"
		}, {
			"Fieldname": "UnitPrice",
			"Edit": false,
			"ScrtextS": "Unit"
		}, {
			"Fieldname": "PriceUnit",
			"Edit": false,
			"ScrtextS": "Price Unit"
		}, {
			"Fieldname": "TotalPrice",
			"Edit": false,
			"ScrtextS": "Total"

		var Column_name = Staic_Feilds;

		var oModel = new sap.ui.model.json.JSONModel();
			columns: Column_name,
			rows: priceData


		oPriceProcedureTable.bindColumns("/columns", function(sId, oContext) {

			var columnName = oContext.getObject().Fieldname;
			var Editable = oContext.getObject().Edit;
			var ScrtextS = oContext.getObject().ScrtextS;

			return new sap.ui.table.Column({
				label: ScrtextS,
				template: new sap.ui.commons.TextField({
					value: {
						path: columnName
					editable: Editable

	error: function() {"No data found");