Skip to Content

sap.ui.table.Table set row editable (XML View Binding with JSON-Model)

Hi all,

after the user selected a row an pressed a dedicated button I developed the following coding:

As you can see the coding is wrong. How do I retrieve the selected row and set it to editable?

Many thanks

Regards

Mario

capture.png (22.5 kB)
Add comment
10|10000 characters needed characters exceeded

  • Follow
  • Get RSS Feed

3 Answers

  • Best Answer
    Feb 15 at 12:47 PM

    Hi,

    I cound solve it. The template I was trying to modify used text-fields which are not editable.

    When I use input-controls, it works fine

    Regards

    Mario

    Add comment
    10|10000 characters needed characters exceeded

  • Feb 15 at 11:19 AM

    Hi,

    it's because getSelectedIndex return an Int not the selected row:

    You have to get the row based on the index:

    oTable.getRows()[index];

    But, be careful with the sap.ui.table.Table. The getRows function return only the visible rows and if you have more rows in your model, this solution does not work.

    I think a better solution is to bind the editable property with a value in the model and then use the getContextByIndex funtion

    (https://sapui5.hana.ondemand.com/1.52.26/#/api/sap.ui.table.Table/methods/getContextByIndex) to retrieve the context in order to change, in the model, the value binded with the editable property .

    Regards,

    Fabrice

    Add comment
    10|10000 characters needed characters exceeded

  • Feb 15 at 11:37 AM

    Hi Fabrice,

    many thanks.

    Getting the row works now. But why does line 80 not work. I would like to set the cells editable.

    I am totally confused. I downloaded a working example from plunker. In this example the line #80 works.

    Why does it not work for me?

    Regards

    Mario


    capture.png (22.2 kB)
    Add comment
    10|10000 characters needed characters exceeded