Quantcast
Channel: SCN: Message List
Viewing all articles
Browse latest Browse all 10548

Re: Bind button in row to the table row

$
0
0

Hi Venkatesh,

 

Thank you for the example. I tried this method, and it works. However, once initally loading the table, it starts of as an editable table. After using the Edit Save button once, it begins to work the way it should.

 

Any idea why this is happening?

 

Here's the code.

 

//TABLE CREATION
oTable = new sap.ui.table.DataTable({  id: "productTable",    title: "Carbon Footprint Data",    selectionMode : sap.ui.table.SelectionMode.Single,  visibleRowCount: 20,  editable : false,                                          enableColumnReordering:false,    });
//COLUMN CREATION
oTable.addColumn(new sap.ui.table.Column({    label: new sap.ui.commons.Label({text:"Edit"}),    template: new  sap.ui.commons.Button({text:"Edit", press: function(){    var currentContext = this.getBindingContext();             var oCurrentModel = currentContext.getModel();             selectedProductID = oCurrentModel.getProperty("ID", currentContext);             if(this.getText()==='Edit'){              this.setText('Save');              oCurrentModel.setProperty('editable',true,currentContext);                }             else{              this.setText('Edit');              oCurrentModel.setProperty('editable',false,currentContext);   }                   }}),    width: "120px"      }));

Viewing all articles
Browse latest Browse all 10548

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>