Skip to Content

Make row editable in sap.m.Table

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();



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");



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?,



Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

2 Answers

  • Best Answer
    Posted on Jul 26, 2016 at 12:53 AM

    Hi Oliver,

    Will this sample help? Plunker



    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Jul 25, 2016 at 03:16 PM

    just put one more attribute in your current table model.

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.