cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

SAPUI5 sap.ui.table.Table: Modify row in Controller

Former Member
0 Likes
2,582

Hi everybody,

I would like to modify the model in the controller. js by using

var oSelectedIndex = oTable.getSelectedIndex();
var row = oTable.getRows()[oSelectedIndex];

I do not know how to preceed?

How can I update the model for the selected row?

Many thanks

Regards

Mario

Accepted Solutions (1)

Accepted Solutions (1)

maheshpalavalli
Active Contributor

Hi Mario Mueller

For UI.Table to update the data you need to follow the below method unlike the normal m.table. first you need to call below to get all selected lines( incase of multiple)

var aSelectedIndices = oTable.getSelectedIndices()

Now you loop on the aSelectedIndices and then call the below method

var oContext = oTable.getContextByIndex(iSelectedIndex);

Once you get the context of that row, get the path and update the property

var sPath = oContext.getPath();
oContext.getModel().setProperty(sPath +"/PropertyName", sValue);

BR,

Mahesh

Answers (1)

Answers (1)

Former Member
0 Likes

Hi Mahesh,

thanks for your reply. The good news: I do not have a syntax error.

But my table get's not update. Do I have to call some kind of "refresh"-method?

Best Regards

Mario

Former Member
0 Likes

sorry; misstake > type

maheshpalavalli
Active Contributor
0 Likes

If you call set property it will immediately update the value to the model and the all the controls which have binded to that property