cancel
Showing results for 
Search instead for 
Did you mean: 
Subscribe

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

0 Likes
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