Skip to Content
0
Jan 18, 2023 at 06:16 AM

Issue with sap.m.table refresh on UI screen

755 Views Last edit Jan 18, 2023 at 06:33 AM 7 rev

Hi All,

I have created a custom UI5 app. In View1, I have used sap.m.table for user input. The table is initially blank, where user can add/ delete rows. After saving the data of the table, I am navigating to View2. But when I come back to View1, the data entered by the user is still there, and not getting refreshed. I have tried the following syntax, but it doesn’t help. I'm saving, adding, deleting, and changing data on the back end, but the UI screen doesn't seem to be cleared/ refreshed. Please advise.

table.png

onInit: function () {
                  this.oScopeTable = this.getView().byId("idtable_newDeal");
                  var TableModel = new sap.ui.model.json.JSONModel([]);
                  this.getView().setModel(TableModel, "tableModel");
                  this.onAddRow();
            }

                  onAddRow: function (oEvent) {
                  var tableModel = this.getView().getModel("tableModel");
                  tableModel.getData().push({});
                  tableModel.refresh();
            },

            onRefresh: function () {
                  // this.getView().getModel("tableModel").setData({
                  // tableModel: {}
                  // });
                  // this.getView().getModel("tableModel").refresh(true);
                  // this.oScopeTable.getModel().refresh(true) ;
                  // this.oScopeTable.getBinding("rows").refresh();
                  // this.oScopeTable.getBinding("items").refresh();
            }

Attachments

table.png (37.1 kB)