[CLOSED] DirectEvent Transaction Time Out Message Window needs refresh on Okay to reset the contents of the page.

  1. #1

    [CLOSED] DirectEvent Transaction Time Out Message Window needs refresh on Okay to reset the contents of the page.

    Sometimes, if a DirectEvent Transaction times out or an exception occurs, a message comes up providing details about the error.

    This is very useful of course, but unfortunately very dangerous if the page has actually changed and only a refresh can remedy. The problem is the OK or Close button on this modal does nothing but make the error message window disappear. The contents of this page however, may no longer be valid and editing the details could cause more errors.

    Is there some way I can make the click OK or Close listeners on this particular window to cause refresh on the page?

    If no, the alternative would be to prevent the modal from closing.

    Please advise...
    Last edited by Daniil; Mar 12, 2014 at 10:16 AM. Reason: [CLOSED]
  2. #2
    Hi @michaeld,

    There are a few options.

    1. Override the Ext.net.DirectEvent.showFailure. Here is the original code.
    showFailure : function (response, errorMsg) {
        var bodySize = Ext.getBody().getViewSize(),
            width = (bodySize.width < 500) ? bodySize.width - 50 : 500,
            height = (bodySize.height < 300) ? bodySize.height - 50 : 300,
            win;
    
        if (Ext.isEmpty(errorMsg)) {
            errorMsg = response.responseText;
        }
    
        win = new Ext.window.Window({ 
            modal: true, 
            width: width, 
            height: height, 
            title: "Request Failure", 
            layout: "fit", 
            maximizable: true,            
            items : [{
                xtype:"container",
                layout  : {
                    type: "vbox",
                    align: "stretch"
                },                
                items : [
                    {
                        xtype: "container",
                        height: 42,
                        layout: "absolute",
                        defaultType: "label",
                        items: [
                            {
                                xtype : "component",
                                x    : 5,
                                y    : 5,
                                html : '<div class="x-message-box-error" style="width:32px;height:32px"></div>'
                            },
                            {
                                x    : 42,
                                y    : 6,
                                html : "<b>Status Code: </b>"
                            },
                            {
                                x    : 125,
                                y    : 6,
                                text : response.status
                            },
                            {
                                x    : 42,
                                y    : 25,
                                html : "<b>Status Text: </b>"
                            },
                            {
                                x    : 125,
                                y    : 25,
                                text : response.statusText
                            }  
                        ]
                    },                    
                    {
                        flex: 1,
                        itemId : "__ErrorMessageEditor",
                        xtype    : "htmleditor",
                        value    : errorMsg,
                        readOnly : true,
                        enableAlignments : false,
                        enableColors     : false,
                        enableFont       : false,
                        enableFontSize   : false,
                        enableFormat     : false,
                        enableLinks      : false,
                        enableLists      : false,
                        enableSourceEdit : false
                    }
                ]
            }]
        });
            
        win.show();
    }
    2. Create a sequence function to the showFailure function, like this:
    Ext.net.DirectEvent.showFailure = Ext.Function.createSequence(Ext.net.DirectEvent.showFailure, function() {
        if (!this.hideListenerAttachedToFailureWindow) {
            win = Ext.ComponentQuery.query("window[title='Request Failure']")[0];
            win.on("hide", function () {
                window.location = window.location;
            });
            this.hideListenerAttachedToFailureWindow = true;
        }
    });
    3. Prevent a failure warning from appearing and showing your own failure window.

    We have a ticket "A possibility to configure a failure window of AJAX request":
    https://github.com/extnet/Ext.NET/issues/226

    I added this thread to there.
  3. #3
    Quote Originally Posted by Daniil View Post
    There are a few options.

    1. Override the Ext.net.DirectEvent.showFailure. Here is the original code.
    Eeek!

    Quote Originally Posted by Daniil View Post
    2. Create a sequence function to the showFailure function, like this:
    Ext.net.DirectEvent.showFailure = Ext.Function.createSequence(Ext.net.DirectEvent.showFailure, function() {
        if (!this.hideListenerAttachedToFailureWindow) {
            win = Ext.ComponentQuery.query("window[title='Request Failure']")[0];
            win.on("hide", function () {
                window.location = window.location;
            });
            this.hideListenerAttachedToFailureWindow = true;
        }
    });
    If I am to understand, where I can customize listeners besides just hide after the win var is defined, but in your case, you have implemented a refresh on hide to match my requirement to refresh. I could do other things in there of course. I don't understand the this.hideList... part but the only real question I have is can I attach other listeners or am I limited to just hide.


    Quote Originally Posted by Daniil View Post
    3. Prevent a failure warning from appearing and showing your own failure window.
    We have a ticket "A possibility to configure a failure window of AJAX request":
    https://github.com/extnet/Ext.NET/issues/226
    I added this thread to there.
    I like #3 best if there's a way to manage it like any other window.
  4. #4
    Quote Originally Posted by michaeld View Post
    can I attach other listeners or am I limited to just hide.
    I think you can customize a failure window as much as you wish.

    Quote Originally Posted by michaeld View Post
    I like #3 best if there's a way to manage it like any other window.
    We will probably implement it one day. No time frame for now.
  5. #5
    Quote Originally Posted by Daniil View Post
    We will probably implement it one day. No time frame for now.
    When you take the time to think about the significance of this one, you realize just how much an issue it is, especially when you consider transnational system that might continue without feedback to the client. I didn't realize it till I ran into the problem myself (with no way to tell the client, I'm still good).

Similar Threads

  1. Replies: 1
    Last Post: Mar 12, 2012, 2:17 AM
  2. Replies: 6
    Last Post: Nov 15, 2011, 2:02 AM
  3. Replies: 2
    Last Post: Oct 11, 2011, 1:15 PM
  4. [CLOSED] Transaction Aborted message
    By egodoy in forum 1.x Legacy Premium Help
    Replies: 3
    Last Post: Jul 11, 2011, 11:46 AM
  5. [1.0]transaction aborted friendly message
    By pbsoft in forum 1.x Help
    Replies: 3
    Last Post: Nov 26, 2010, 12:56 AM

Posting Permissions