Skip to Content
Former Member
Jun 11, 2016 at 12:56 PM

Change Sap.m.table binding dynamically between odata and JSON models


Hi ,

I have this requirement to toggle the displayed data in a sap.m.table on click of a button within two different models .

At first the data is bound to a Odata service , but when the user clicks 'add' button in toolbar , the table should go blank, and provide

just a empty table , with a line to insert data - this data will be added to the backend. Now if user decides to discard his entries in the add mode , the table should switch back to display the previously displayed entries.Right now , I'm setting the model of table to a named json model with a empty entry when the ADD button is clicked , and calling bindItems() method to display the empty row .

Can anyone help me with a sample code to accomplish the switch back to the odata model?