Reputation: 151
I have binded a Table using oData like below.
<Table id="myTableID"
class="sapUiResponsiveMargin"
items="{Items}"
noDataText="{i18n>NoDataText}"
updateFinished="onUpdateFinished"
width="auto">
Now I need to retrieve this oData model from the view rather than calling the web service again.
I have tried the below,
var path = this.getView().getElementBinding().getPath();
var oModel = this.getView().getModel();
which returns the model from the parent view.
Is there a way to achieve this?
Upvotes: 3
Views: 11093
Reputation: 6190
I assume that you want only the items that are bound to the table.
var sPath = oTable.getBindingPath("items");
This gives you the path that you have bound to the items
aggregation.
var oModelObject = oTable.getModel().getProperty(sPath);
This fetches only the table bound objects from your model
Edit oTable
is your table object. var oTable = this.getView().byId("myTableID");
Upvotes: 2