Sencha Inc. | HTML5 Apps

Window FAQ

Published Sep 17, 2010 | The Sencha Dev Team | FAQ | Medium
Last Updated Jul 11, 2011

This FAQ is most relevant to Ext JS, any version.

This article is currently due for review
We suspect that this article may be out-of-date or contain incorrect information.
But we are constantly editing articles, so we promise we will get to this one soon.

After closing my Window, showing it again doesn't show the contents

By default, clicking the "close" tool in the Window header, destroys the Window. Ext's lifecycle management then destroys all child Components of the Window.

Attempting to show it after that will have undefined results.

Use the closeAction: 'hide' configuration.

Focus after showing Window

Here is a simple Window :

Ext.onReady(function(){
 
        var tf = new Ext.form.TextField();
        new Ext.Window({
            renderTo: document.body,
            title: 'Test',
            items: tf,
            height: 400,
            width: 600
        }).show();
        tf.focus();
 
    });
  • Result Expected : the text field is focused.
  • Result Witnessed: The Window's focusEl is focused.

To fix it (ticket 220), add this fix :

Ext.override(Ext.Window, {
    toFront : function(e){
        if(this.manager.bringToFront(this)){
            if(e && !e.getTarget().focus){
                this.focus();
            }
        }
        return this;
    }
});
Share this post:
Leave a reply

Written by The Sencha Dev Team

Commenting is not available in this channel entry.