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

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

View Entire Topic
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