Results 1 to 2 of 2

Thread: 2.0 Desktop modal popup window

  1. #1

    Join Date
    Aug 2007
    Location
    Romania
    Posts
    42

    Default 2.0 Desktop modal popup window

    Hi everybody, a small contribution for the community.
    I use 2.0 desktop for a while, and had some problems with pop-up Add/Edit windows with modal:true attribute. I needed modal, but only on the main module window. I also needed to hide pop-ups when minimizing the main window, and show them when the main window becomes active again, and of coarse when closing the main window, the pop-up should close too.
    I extended the Ext.Window class, so that i can do this more easily. Here is my extension:
    filename: Module.Popup.js
    PHP Code:
    /*
     * Ext 2.0 desktop module, Popup window extension
     * It creates a Popup window, that masks the main module window, but lets user minimize, maximize, and close the main module window (mainWin).
     * The effect of all mainWin operations on this Popup window is show/hide.
     */

    Ext.namespace("Ext.app.Mod");

    Ext.app.Mod.Popup = function(config){
        
    Ext.apply(thisconfig);
        
    Ext.app.Mod.Popup.superclass.constructor.call(this);
        
    this.init();
        
    //mainWin body is masked, so that mainWin header is still active
            
    this.on('show', function() {
            
    this.mainWin.body.mask();
            }, 
    this);
            
    //mainWin body is unmasked
            
    this.on('close', function() {
            
    this.mainWin.body.unmask();
            }, 
    this);
            
    //Popup hides, on mainWin minimize
            
    this.mainWin.on('minimize', function() {
            
    this.hide();
            }, 
    this);
            
    //Popup shows, on mainWin activate
            
    this.mainWin.on('activate', function() {
            
    this.show();
            }, 
    this);
            
    //Popup closes, on mainWin close
            
    this.mainWin.on('close', function() {
            
    this.close();
            }, 
    this);
    }

    Ext.extend(Ext.app.Mod.PopupExt.Window, {
        
    init : function() {
            
        }
    }); 
    usage is simle:

    the main window
    PHP Code:
    var win desktop.createWindow({
           ....
           
    tbar: [{
              
    handler: function(){
                         var 
    popup = new Ext.app.Mod.Popup({
                                ....
                                
    closeAction:'close',
                                
    mainWin:win,
                                ....
                          });
                          
    popup.show();

                  },
              
    scopethis,
              
    text'Open Dialog'
        
    }]
           ....
    }); 
    I hope someone will find this useful.

  2. #2
    franckxx
    Guest

    Default

    hi attiato,

    Thx for share

Posting Permissions

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