Results 1 to 2 of 2

Thread: is closable Ext.Window destroyed from dom on close?

  1. #1
    Ext JS Premium Member
    Join Date
    Jul 2009
    Posts
    122

    Default is closable Ext.Window destroyed from dom on close?

    Hi,

    I have a simple popup, which is like a sticky note that is rendered with config containing (initial) x and y coordinates. When I first show it, it puts in in the right position. It is draggable, so if user drags it, it moves. It is closeable, so it closes. I have a link in the page which reopens it, calling the same function. Ext.getCmp() returns null for the popup, so I presume the clicking of close has destroyed it, yet when I recreate the popup, using those same x,y initial coords, ExtJS remembers the previous ones, and ignores x,y in config on second open. How does ExtJS remember the previous coordinates the user dragged to, while at the same time Ext.getCmp() returns null. Either the component has not been destroyed, in which case I would think the Ext.getCmp() should not return null, or ExtJS maintains a map of all coordinates for all windows that have been opened and moved at any time, by id, and this map could get huge!

    Here's my code:

    Code:
    function ShowPopup (beginword, text, title, width, height)
    {
        var id = PopupId(beginword);
        var popup = Ext.getCmp(id);
        if (popup) {
            // never hit after user closes and reopens!
            popup.show();
            return;
        }
    
        var spanxy = GetCenterElemXY(BookPanel(), 'staganno'+beginword);
        if (!spanxy)
            return;            // wrong page
    
        var config = PopupConfig(text, title);
        config.autoScroll = true;
        config.width = width;
        config.height = height;
        config.id = id;
        config.x = spanxy.left;        // ignored on close/reopen!
        config.y = spanxy.bottom;  // ignored on close/reopen!
        config.renderTo = Ext.getCmp('center_panel_id').body;
        popup = new Ext.Window(config);
        RegisterStateEventListener('beforepagechange', function () { popup.destroy(); return true; });
        popup.show();
    }
    
    function PopupConfig (text, title)
    {
        var config = {
            draggable : true,
            resizable : true,
            closable : true,
            title : title,
            plain : true,
            bodyStyle : 'padding:5px;',
            html : text,
        };
        return config;
    }
    Andy

  2. #2
    Sencha User hendricd's Avatar
    Join Date
    Aug 2007
    Location
    Long Island, NY USA
    Posts
    5,966

    Default

    Use popup.close() instead.
    "be dom-ready..."
    Doug Hendricks

    Maintaining ux: ManagedIFrame, MIF2 (FAQ, Wiki), ux.Media/Flash, AudioEvents, ux.Chart[Fusion,OFC,amChart], ext-basex.js/$JIT, Documentation Site.


    Got Sencha licensing questions? Find out more here.


Posting Permissions

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