本文介绍了“metadataLoaded"的替代品是什么?在 JSONModel 中?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
在sap.ui.model.odata.v2.ODataModel
中,有一个metadataLoaded
方法,我可以这样使用它:
In sap.ui.model.odata.v2.ODataModel
, there is a metadataLoaded
method which I can use it like this:
this.getModel().metadataLoaded().then( function() {
var sObjectPath = this.getModel().createKey("/", {
ID : sObjectId
});
this._bindView("/" + sObjectPath);
}.bind(this));
JSONModel
似乎没有相应的方法,因为客户端模型中没有服务元数据概念.那么还有其他解决办法吗?
JSONModel
doesn't seem to have a corresponding method since there is no service metadata concept in client-side models. So is there any other work around?
我尝试了 attachRequestCompleted
.它没有按预期工作:
I tried attachRequestCompleted
. It's not working as expected:
function bindview() {
that._bindView(sObjectId);
}
this.getModel().attachRequestCompleted(bindview);
推荐答案
正如你所说的,没有元数据.但是对于 Json 模型,为什么要等待任何事件?可以直接绑定视图.
As you rightly said, there is no metadata. But for Json model why do you want to wait for any event? You can directly bind the view.
这篇关于“metadataLoaded"的替代品是什么?在 JSONModel 中?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!