2017-01-04 5 views
-1

I ', oData v2 모델을 사용하여 간단한 SAP Fiori 애플리케이션을 생성합니다. .create (...) 요청을 구현했으며 백엔드 시스템에서 작동하지만 성공 콜백 기능에 문제가 있습니다.oData .create 요청 후 성공 보류

새 개체를 만든 후 해당 번호의 메시지 토스트를 표시하고 이전보기로 돌아가고 싶습니다.

성공/오류 (_onBatchError) 콜백 내에서 _createNotification 함수의 객체를 어떻게 사용할 수 있습니까?

this, that, oModel

_createNotification: function() { 
 

 
    var oModel = this.getModel(); 
 
    var that = this; 
 
    // .... 
 

 
    oModel.create("/NotificationHeaderSet", oNotification, { 
 
\t \t \t \t 
 
    success: function(oData, oResponse) { 
 
\t MessageToast.show(oData.NotificationNo); // How to get i18n ? 
 
     // this.getRouter().navTo("worklist", {}, true); 
 
\t }, 
 
    error: this._onBatchError 
 
    }); 
 

 
}
는 정의되지 않습니다 (이 콜백 기본/국제화 모델을 잘 처리 외부) sap.ui.core.getCore().getModel()

는 아마 일부 더미 오류가 널 (null) 제공하지만, 나는 아이디어 나갈거야 .

미리 감사드립니다. jQuery.proxy와 야쿱

답변

1

는 작동합니다 :

_createNotification: function() { 
 

 
    var oModel = this.getModel(); 
 
    var that = this; 
 
    // .... 
 

 
    oModel.create("/NotificationHeaderSet", oNotification, { 
 
\t \t \t \t 
 
    success: jQuery.proxy(function(oData, oResponse) { 
 
\t MessageToast.show(oData.NotificationNo); // How to get i18n ? 
 
     this.getRouter().navTo("worklist", {}, true); 
 
\t }, this), 
 
    error: this._onBatchError 
 
    }); 
 

 
}

+0

덕분에, 지금은 작동합니다. – plota