开发者

Extjs Ext.data.Connection in "requestcomplete" stop proceeding further process

开发者 https://www.devze.com 2023-01-23 18:13 出处:网络
In my application we are using many grids and many ajax request, my requirement is, If session is timed out say alert msg to user and redirect to login page.

In my application we are using many grids and many ajax request, my requirement is, If session is timed out say alert msg to user and redirect to login page.

For that i have used the Ext.data.Connection ("requestcomplete" event) like below..

Ext.util.Observable.observeClass(Ext.data.Connection);

Ext.data.Connection.on('requestcomplete', function (dataconn, response, option) {
    if (IsSessionTimedOut) // its sets true when Session TimedOut
    {
        Ext.MessageBox.alert('Responce Status', 'Your session has expired.', function () {
        RedirectToLogin() //});
        //  i neeed to break here (i.e it should not proceed further from where the request is made(store or ajax))
    }
});

For example if ajax call is made after "requestcomplete" it come开发者_C百科s to success event of ajax. i need to break in requestcomplete event itself, it should not go to success event when the session is timed out.

i tried by "return false" its not worked out

how it can be done ?

Thanks in advance


Short answer: Ext.Ajax.suspendEvents()

http://dev.sencha.com/deploy/dev/docs/source/Observable.html#method-Ext.util.Observable-suspendEvents

0

精彩评论

暂无评论...
验证码 换一张
取 消