[Solved]Help needed on creating nested Windows

  • Hi,

    I'm building a component that uses nested Windows. I understand that Window component was not designed with this situation in mind, but I do need them (instead of floating panel) because of the resizing and dragging. And so I'm having problems since the Ext.Window.show method at first renders the window at documents's body (which is not what I want). As I don't fully understand Ext's rendering/showing component cycle yet, I would like some advises on how to achieve this correctly.

    Regads,
    Thiago Souza


  • Try something like this:


    var destroy_list = ;
    var host= new Ext.Window({
    width:700,
    height: 500,
    renderTo: Ext.getBody(),
    title:'Window Host',
    id: 'theHost',

    //cleanup them all up on shutdown
    //This is IMPORTANT, because the child Windows MUST be removed before the Host
    //window or you'll have Element orphanage on your hands !

    listeners: {
    beforeclose : function(host){
    Ext.each( destroy_list, function(child){
    if(child){
    var m = child.manager; //ask its WindowManager if it
    if(m && m.get(child.id)){ //has it already been closed?
    child.close(); //destroy it
    }
    }
    });
    }
    }
    });
    host.show(); //must render it first, to create the 'body' (container for the other windows)

    var w, b=host.body;

    for(var i=0,i<10,i++){
    w = new Ext.Window({
    x: (i*10)+10,
    y: (i*10)+10,
    renderTo : b,
    constrainHeader: true,
    id : 'host_win'+i,
    width:100,
    height: 300});
    w.show();
    destroy_list.push(w); //keep a list of each window created for proper disposal
    }


  • Hi,

    Thanks! It works flawlessly!!!

    Regards,
    Thiago Souza







  • #If you have any other info about this subject , Please add it free.#
    Your name:
    E-mail:
    Telphone:

    Your comments:


    If you have any other info about [Solved]Help needed on creating nested Windows , Please add it free.

    7 January 2009 | cameltoepants.com | edit