Skip to content Skip to sidebar Skip to footer

Why Metadataloaded Can Be Fired Multiple Times?

Related question: What is the replacement for metadataLoaded in JSON model? When I use metadataLoaded in sap.ui.model.odata.v2.ODataModel, Everytime _onObjectMatched is called ,

Solution 1:

_onObjectMatched() is called everytime your route matches. In there you always call this.getModel().metadataLoaded().then(...) while metadataLoadad() returns a promise which resolves when the metadata is loaded (in the past or in the future). This happens everytime because this.getModel().metadataLoaded().then(...) is called everytime.

Probably it's a good idea to have a look at Promises, I'm sure you'll get the idea. In fact, make sure you understand the difference between events and Promises...

Post a Comment for "Why Metadataloaded Can Be Fired Multiple Times?"