Hello SAPUI5 Experts,
I have a question which I'm not even sure how to approach. I have a sapui5 Table and want to have Button for every row which makes the row editable.
To make the cells editable i filled them with sap.m.Input Elements which shouldn't be editable in the beginning. Since I want to have access to the editable property i put it inside a JSON Model.
var data = new Object();
data.row =false;
var oModel = new sap.ui.model.json.JSONModel();
oModel.setData(data);
this.getView().byId("Table1").setModel(oModel,"rowModel");
Here you see my Controller in which i define the cells with a reference to an Odata Model and in the editable Property to the Model.
cells: [ new sap.m.Input({ value: "{ProductName}", editable: "{rowModel>/row}" }),If i execute following code after a button Press the whole table becomes editable:
var rowModel = view.byId("Table1").getModel("rowModel");rowModel.oData.row=true;
rowModel.updateBindings();
Now my Question. If I could bind every Row to a different rowModel then i could make every Row editable like this. I'm not sure how to do that since that would mean that my table has to have two items Aggregations, right?
I didn't find a simple way to do it like sap.ui.table which has the editabled Property for rows. Am i on the right Track?,
Greetings,
Oliver