cancel
Showing results for 
Search instead for 
Did you mean: 

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

02-18-2019 6:48 AM
maheshpalavalli Active Contributor
1268 views 0 comments Go to solution
0 Likes
SAP Managed Tags
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