on 01-24-2014 8:04 PM
Hi Saneth,
On click on buttons, change the model and set the model to table inside press function.
It will reflect in table immediately.
And if you tell which type of operations you want to do, we can help better..
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Saneth,
current binding context could be used to edit and delete row
below example might help
http://jsbin.com/uxokuc/362/edit
Thanks and Regards, Venkatesh
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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"
}));
User | Count |
---|---|
90 | |
10 | |
10 | |
10 | |
7 | |
7 | |
6 | |
5 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.