Results 1 to 6 of 6

Thread: Hide Ext.window on loose focus

  1. #1
    Sencha User imoise's Avatar
    Join Date
    Sep 2007
    Location
    Bucharest,Romania
    Posts
    42

    Question Hide Ext.window on loose focus

    Hy, I'm just wondering is there a way to hide a Ext.Window when you click outside the window? I've looked around but fount nothing similar .
    Do not underestimate the power under my imbecility...

  2. #2
    Sencha User husniadil's Avatar
    Join Date
    Jul 2009
    Location
    Yogyakarta, Indonesia
    Posts
    45

    Default

    try this

    HTML Code:
    <script type="text/javascript">
        
    function showWindow() {
        var win = new Ext.Window({
            width: 400,
            height: 300,
            modal: true,
            title: 'Hello',
            bodyStyle: 'padding: 10px; font-size: 16px; font-weight: bold',
            html: 'click in any place outside the window',
            listeners: {
                show: function() {
                    Ext.select('.ext-el-mask').addListener('click', function() {
                        win.close();
                    });
                }
            }
        });
        win.show();
    }
    
    </script>
    <a href="#" onclick="showWindow();">Click here</a>

  3. #3
    Sencha User
    Join Date
    Sep 2009
    Location
    Calgary, Alberta, Canada
    Posts
    638

    Default

    There is a deactivate event on window.

    Not too sure if this helps.

  4. #4
    Sencha User husniadil's Avatar
    Join Date
    Jul 2009
    Location
    Yogyakarta, Indonesia
    Posts
    45

    Default

    How about this?
    PHP Code:
    function showWindow() {
        var 
    win = new Ext.Window({
            
    width400,
            
    height300,
            
    modaltrue,
            
    title'Hello',
            
    bodyStyle'padding: 10px; font-size: 16px; font-weight: bold',
            
    html'click in any place outside the window',
            
    listeners: {
                
    show: function() {
                    
    Ext.select('.ext-el-mask').addListener('click', function() {
                        
    win.close();
                    });
                }
            }
        });
        
    win.show();

    PHP Code:
    <a href="#" onclick="showWindow();">Click here</a

  5. #5
    Sencha Premium Member milestonebass's Avatar
    Join Date
    Dec 2009
    Location
    Melbourne, Australia
    Posts
    28

    Question Modal

    Only works for modal windows, of course.
    How would you suggest the same functionality for a non-modal window?

  6. #6

    Default check this

    hideOnMaskTap:true,
    listeners : {
    hide: function() {
    this.destroy();
    }
    },

Posting Permissions

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