0

//以下は、いくつかの応答コードを返すコールバック メソッドです。ここで、コールバック メソッドから別のビューに移動する必要があります。このロジックは、ユーザー ログインで使用しています。以下の別のビューに移動できる解決策を提供してください。別のビューに移動するために使用したコードを宣言しました。これは、コールバック メソッド内ではなく、コールバック メソッドの外で正常に動作します。

 Ext.data.JsonP.request({
                url:'url',
                method: 'POST',
                callbackkey: 'callback',
                params: {
                    userID: user_Id,
                    password: password,
                    format: 'json'
                },
                callback: function (response, value, request) {
                       //Logic should come here
                    }
                    else
                    {
                    }
                },

                failure: function (response, request) {
                }
            });

enter code here

// 以下は cofig エントリです

config: {
        refs: {
            homepage:'HP'
        }
    }

//成功ブロックに以下のコードを追加していますが、エラーが発生しています

  var noteEditor = this.getHomepage();
  Ext.Viewport.animateActiveItem(noteEditor, this.slideLeftTransition);
4

1 に答える 1

0

あなたが何かをしていると仮定して

Ext.data.JsonP.request({
            url:'url',
            method: 'POST',
            callbackkey: 'callback',
            params: {
                userID: user_Id,
                password: password,
                format: 'json'
            },

            scope: this,      /// fix handler scope

            callback: function (response, value, request) {
                if () {
                   //Logic should come here
                   var noteEditor = this.getHomepage();
                   Ext.Viewport.animateActiveItem(noteEditor, this.slideLeftTransition);     
                }
                else
                {
                }
            },

            failure: function (response, request) {
            }
});

スコープを追加する必要があります: このプロパティを ajax 呼び出しに追加します。

乾杯、オレグ

于 2012-08-01T13:49:12.417 に答える