cancel
Showing results for 
Search instead for 
Did you mean: 

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

0 Kudos

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

Accepted Solutions (1)

Accepted Solutions (1)

0 Kudos

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

Answers (2)

Answers (2)

0 Kudos

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

Fabrice
Active Participant
0 Kudos

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