Search code examples
javascriptinternet-explorerextjsinternet-explorer-8extjs3

Extjs 3.3 IE8 chained events is breaking


This one is wired.

This fires from a grid toolbar button click:

// fires when the client hits the add attachment button.
onAddAttachmentClick: function () {
    var uploadAttachmentsWindow = new Nipendo.ProformaInvoice.Attachment.UploadWindow({
        invoice: this.invoice,
        maxFileSizeInMB: this.maxFileSizeInMB
    });

    uploadAttachmentsWindow.on('uploadcomplete', function (win, message) {
        if (message.msg !== 'success') {
            return;
        }

        win.close();
        var store = this.getStore();

        store.setBaseParam('useCache', false);
        store.load();

        this.fireEvent(
            'attachmentuploaded',
            this.invoice.ProformaInvoiceNumber,
            this.invoice.VendorSiteID,
            this.invoice.CustomerSiteID);

    }, this);

    uploadAttachmentsWindow.show();
} // eo onAddAttachmentClick

This is what happens on the uploadcomplete event:

this.uploadBtn.on('click', function () {
    var form = this.uploadForm.getForm();

    if (!form.isValid()) {
        return;
    }

    form.submit({
        url: 'XXX.ashx',
        waitMsg: Nipendo.Localization.UploadingAttachment,
        scope: this,
        success: function (form, action) {
            this.fireEvent('uploadcomplete', this, {
                msg: 'success',
                response: action.response
            });
        },
        failure: function (form, action) {
            switch (action.failureType) {
                case Ext.form.Action.CLIENT_INVALID:
                    this.fireEvent('uploadcomplete', this, {
                        msg: 'Form fields may not be submitted with invalid values'
                    });
                    break;
                case Ext.form.Action.CONNECT_FAILURE:
                    this.fireEvent('uploadcomplete', this, {
                        msg: 'Ajax communication failed'
                    });
                    break;
                case Ext.form.Action.SERVER_INVALID:
                    Ext.Msg.alert(action.result.title, action.result.message);
                    this.fireEvent('uploadcomplete', this, {
                        msg: action.result.message
                    });
                    break;
            }
        }
    });

}, this);

On IE 8 I am getting this error in the debugger:

enter image description here

I have no idea what object is missing... from my check they are all defined.

Any idea anyone?

Notice that I have an event firing from a listener (I am suspecting it to be the root of the problem).

It is hard to see but the error occuers in ext-all.js in the fire method.


Solution

  • I have found the answer in : https://stackoverflow.com/a/3584887/395890

    Problem was I was listing to events is 2 different windows, that is not possible in Ext.

    What I have done to solv it was to call the opner window from the pop up window to notify about changes.