Results 1 to 3 of 3

Thread: destroy is not working for BasicDialog in IE

  1. #1
    Sencha Premium Member ethraza's Avatar
    Join Date
    Jun 2007
    Location
    Brazil
    Posts
    379

    Exclamation destroy is not working for BasicDialog in IE

    Imagem a function that creates my dialogs:
    Code:
    function createbox(...) {
    var bdlg = new Ext.LayoutDialog(Ext.id(), {
                   autoScroll: true,
                   width: iWidth,
                   height: iHeight,
                   minWidth: 150,
                   minHeight: 100,
                   modal: bModal,
                   proxyDrag: true,
                   shadow: true,
                            center:{
                                    alwaysShowTabs: false,
                                    fitContainer: true,
                                    fitToFrame: true,
                                    autoScroll: true
                            }
    });
                    bdlg.addButton(p[0], eval(p[1]), bdlg);
                    bdlg.body.load({url: sContent, scripts:true, params:sParams})
                    bdlg.header.update(sTitle)
                    bdlg.addKeyListener(9, function(i,k,e){e.stopEvent()}, bdlg); // Trying to stop TAB to keep modal
                    bdlg.addKeyListener(27, function(){bdlg.destroy(true)}, bdlg); // ESC to close
                    bdlg.show();
                    return bdlg;
    }
    Now, on scripts I call that function and the returned object go to a variable:
    <script>
    var bx = createbox(...);
    bx.destroy();
    </script>

    When I call destroy() or hide(), with basicdialog or layoutdialog, it works and close the dialog on FF2 but not works on IE6 or 7.
    Why? Is a bug or my mystake?

    Thanks!

    *** Edited to get the addKeyListener for TAB working!
    LAMPE (Linux / Apache / MySQL / PHP / ExtJs)

  2. #2
    Sencha Premium Member ethraza's Avatar
    Join Date
    Jun 2007
    Location
    Brazil
    Posts
    379

    Post Ok, my mistake

    For anyone that may pass through it one day, I resolved like this:

    <script>
    window.bx = createbox(...);
    window.bx.destroy(true);
    </script>


    What I did is to define the bx variable in the window global scope on creation time, so it can be accessed from anywhere on IE.
    On firefox it is not necessary but works too, so if u want cross browser, you need to use the window scope.
    LAMPE (Linux / Apache / MySQL / PHP / ExtJs)

  3. #3
    Ext JS Premium Member
    Join Date
    Sep 2007
    Location
    CT
    Posts
    462

    Default Layout Dialog

    Using IE 6 with v 1.1

    I was having a problem where the setTitle would not replace the title on an existing dialog

    To solve the problem I had to destroy the object and have to set the boolean parameter to true otherwise the window title remained the same.

    In the object constructor I set

    var self = this;
    self.lDialog = null;


    In success dialog method I have the following:

    if (self.lDialog)
    {
    self.lDialog.destroy(true);
    }

    self.lDialog = new Ext.LayoutDialog("msg",{autoCreate:true,autoScroll:true,height:575, width:775, modal:true,proxyDrag:true,shim:true});

    self.lDialog.setTitle("Success");
    self.lDialog.body.update('<div id="Dialog" style="border:1px solid #99bbe8;overflow: scroll; width: 100%; height: 100%; background-color:#FFFFFF">Success Message</div>');

    In the failure dialog I have:

    if (self.lDialog)
    {
    self.lDialog.destroy(true);
    }

    self.lDialog = new Ext.LayoutDialog("msg",{autoCreate:true,autoScroll:true,height:575, width:775, modal:true,proxyDrag:true,shim:true});

    self.lDialog.setTitle("Failure");
    self.lDialog.body.update('<div id="Dialog" style="border:1px solid #99bbe8;overflow: scroll; width: 100%; height: 100%; background-color:#FFFFFF">FailureMessage</div>');

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •