Skip to Content
0

sap ui table does not show changes from the model

Jun 13, 2017 at 09:54 AM

49

avatar image

We have a table with its rows bound by an ODataModel (V2).

<Table id="tbl1" selectionMode="None" rows="{/service}">

On a user input, we want to search through all the rows of the table and update the non-key field of the one we need.

Once the changes are made to the model, we would like the table to reflect the changes of the model but this does not seem to be working.

var oData = oModel.getProperty("/service(KEY='VALUE')");

oData["NON_KEY_FIELD"] = "NEWVALUE";

oModel.setProperty("/service(KEY='VALUE')", oData, null, true);

oModel.refresh(); // works but loads the old data back

oTable.rerender(); //does not work.

What works though is, scrolling the table. The scroll shows the changes to the row correctly.

10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

1 Answer

VIPLOVE KHUSHALANI Jun 13, 2017 at 10:30 AM
0

Hi Ravin Shende,

If you check the setProperty of odata model that it only updates the property but it doesn't make any server call so no update on server. And for making a server call you need to call submitChanges method. Read the description of the setProperty carefully in the link below :

https://openui5beta.hana.ondemand.com/1.28.36/docs/api/symbols/sap.ui.model.odata.ODataModel.html#setProperty

thanks

Viplove

Show 2 Share
10 |10000 characters needed characters left characters exceeded

Hi Viplove - Thanks for looking into this.

We don't want to update the changes to server.

The data comes from server via OData, the change come from UI (sap.m.Input) and these need to go into an appropriate row of the table and have to be displayed on the UI. At this moment, the changes need not be pushed and can only stay on UI.

0

Hi Ravin Shende ,

Ok got it ... you need to update the bindings .. use updateBindings(true) function to force to update bindings .

var oData = oModel.getProperty("/service(KEY='VALUE')");

oData["NON_KEY_FIELD"] = "NEWVALUE";

oModel.setProperty("/service(KEY='VALUE')", oData, null, true);

oModel.updateBindings(true);

thanks

Viplove

0