I try to set a model to a view in onBeforeShow hook after I navigate to that view (using Router).
Here is my relevant view code part:
<Table items="{path:'model>/'}">
<columns>
<!-- columns definition here -->
</columns>
<items>
<ColumnListItem>
<cells>
<Text text="{model>property1}"/>
<Text text="{model>property2}"/>
<Text text="{model>property3}"/>
<Text text="{model>property4}"/>
<Text text="{model>property5}"/>
</cells>
</ColumnListItem>
</items>
</Table>
Then, in onBeforeShow:
var oData = sap.ui.getCore().getModel("modelSource");
this.getView().setModel(oData, "model");
"modelSource"
is defined in the previous view.
When executing the model set line, I get the following error:
TypeError: e.bindList is not a function
Here is my onBeforeShow hook definition (credits to this post):
onInit: function() {
this.getView().addEventDelegate({
onBeforeShow : jQuery.proxy(function(evt) {
this.onBeforeShow(evt);
}, this)
});
},
How to fix the issue?
Thanks.