2017-01-04 10 views
-1

I '、oData v2モデルを使用して簡単なSAP Fioriアプリケーションを作成します。 私は.create(...)リクエストの実装を行いました。バックエンドシステムで動作しますが、成功コールバック関数に問題があります。oData .createリクエストの後に成功するコールバック

新しいオブジェクトを作成した後、その番号のメッセージトーストを表示して前のビューに戻したいとします。

成功/エラー(_onBatchError)コールバック内で_createNotification関数のオブジェクトを使用するにはどうすればよいですか?

_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 
 
    }); 
 

 
}

this, that, oModel未定義で、(このコールバックデフォルト/国際化モデルが細かい処理される外)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

関連する問題