简体   繁体   中英

SAP UI5 How to refresh the model data in table

I have a sap.ui.Table with 10 records. If I perform any operation on that sap.ui.Table like Submit by selecting a particular row, operation should perform and Row should get removed from the table. Row data is getting submitted but row is not getting removed from the table. I tried by refreshing the table. But didn't worked for me. Below is the piece of code.

            this.oDataModel.create("/testService", dataToSend, {
            success: function(data, resp) {                 
                var oXML = jQuery.parseXML(resp.headers["sap-message"]);
                var oXMLMsg = oXML.querySelector("message");
                var response = oXMLMsg.textContent;
                MessageBox.success(response);

                var listBinding = this.getView().byId("idLeaveTable");
                var leaveModel = listBinding.getModel("approvalModel");
                leaveModel.refresh(true);
                that.successApprovalModel();
            },
            error: function(err) {
                var oXML = jQuery.parseXML(err.response.body);
                var oXMLMsg = oXML.querySelector("message");
                MessageBox.error(oXMLMsg.textContent);
            }
        });

Here if iam submitting any row to backend service then corresponding row should get removed from both table and model. As of now it is not happening. But if im reloading the application then the corresponding row is getting removed.

Can some one please help me to resolve the issue.

Thank you in advance

你能试试这个吗:

this.byId("lineItemsList").getBinding("items").refresh();

For the oData model you should use the method 'remove' to trigger a DELETE request to the oData service. The 'create' method triggers a POST request.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM