Skip to Content
0
Jul 21, 2023 at 08:28 AM

SAPUI5 suspend / resume oData binding not triggering

234 Views

I need to setup oData binding in a view so that, by default the items aggregation of a table (containing products) is 'suspended' until I click a button that 'resumes' the binding and loads in the products.

Example is here UI5 Tips: Use of Binding Suspend | SAP Blogs but when I try to apply this to the items aggregation of a table, the resume() does nothing, and no products are shown.

 <Table id="productsTable"
items="{path: 'Products', suspended: true }"
 onProductSearchAll: function (oEvent) {
const oView = this.getView();
const table = oView.byId("productsTable");
const binding = table.getBinding("items");
binding.resume(); }

For now, the workaround has been to NOT include the items aggregation in the view, and to unbind/bind the items aggregation in the controller.

This is a more cumbersome solution, so would be good to confirm why the cleaner suspend/resume solution fails in this scenario.