Skip to Content
avatar image
Former Member

sap ui table does not show changes from the model

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.

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

1 Answer

  • Jun 13, 2017 at 10:30 AM

    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

    Add comment
    10|10000 characters needed characters exceeded

    • 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