继best practice guide我得到一个错误“遗漏的类型错误:未定义是不是一个函数”。attachEventOnce()导致“未定义是不是一个函数”
通过大量的在下面的代码行,我发现这个错误被抛出console.logs(匿名在控制台)的:
oView.getElementBinding().attachEventOnce(....)
AttachEventOnce()是导致问题的功能。你有一个想法如何解决这个问题或进一步调试?
的代码块:
oView.getElementBinding().attachEventOnce("dataReceived", jQuery.proxy(function() {
var oData = oView.getModel().getData(sReportPath);
if (!oData) {
sap.ui.core.UIComponent.getRouterFor(this).myNavToWithoutHash({
currentView : oView,
targetViewName : "namespace.view.NotFound",
targetViewType : "XML"
});
}
}, this));
从最佳实践指南引用:
// Check that the product specified actually was found oView.getElementBinding().attachEventOnce("dataReceived", jQuery.proxy(function() { var oData = oView.getModel().getData(sProductPath); if (!oData) { sap.ui.core.UIComponent.getRouterFor(this).myNavToWithoutHash({ currentView : oView, targetViewName : "sap.ui.demo.tdg.view.NotFound", targetViewType : "XML" }); } }, this));
这整个事情是 “routeMatched” 一节中被解雇。
之前会发生什么?在最佳实践指南中的这个呼叫之前有一些行。您是否尝试过Chrome的功能来停止异常? – matbtt
@matbtt我想我找到了错误。这是OData后端的一个问题。我没有实现“readEntity”......啊,不需要检查我的答案; P – OddDev