In sap.ui.model.odata.v2.ODataModel
,有一个metadataLoaded https://openui5.hana.ondemand.com/#docs/api/symbols/sap.ui.model.odata.v2.ODataModel.html#event:metadataLoaded我可以这样使用它的方法:
this.getModel().metadataLoaded().then( function() {
var sObjectPath = this.getModel().createKey("/", {
ID : sObjectId
});
this._bindView("/" + sObjectPath);
}.bind(this));
JSONModel https://openui5.hana.ondemand.com/#docs/api/symbols/sap.ui.model.json.JSONModel.html似乎没有相应的方法,因为没有服务元数据客户端模型中的概念。那么还有其他解决办法吗?
I tried attachRequestCompleted
。它没有按预期工作:
function bindview() {
that._bindView(sObjectId);
}
this.getModel().attachRequestCompleted(bindview);
正如您所说,没有元数据。但是对于 Json 模型为什么要等待任何事件呢?可以直接绑定视图。
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)