1. #1
    macm
    Guest

    Default Open Multiple LayoutDialogs.. I am going Crazy!!

    Open Multiple LayoutDialogs.. I am going Crazy!!


    I have to say thank you to everyone who has created this awesome resource. And to everyone that posts on these forums.

    I am having a tough time opening up multiple dialogs. I want to create them on the fly, so I will not have DIVs coded into the page. What is happening is, first dialog created fine and is draggable..etc. Second dialog is created fine and is draggable etc.. But once the second dialog is created, the first one no longer responds to anything. I am assuming it is because I am reusing a variable/element somewhere, but for the life of me I can not figure it out.

    My HTML:
    Code:
    <div id="hello-dlg" style="visibility:hidden;position:absolute;top:0px;">
            <div class="x-dlg-hd">Search Assets</div>
            <div class="x-dlg-bd">
                <div id="center" class="x-layout-inactive-content" style="padding:10px;"></div>
            </div>
        </div>
    My Javascript (this is called from a click handler of a treeview)..There is also a tree inside of the dialog, but that works fine.. of course it disappears from the first dialog when the second dialog is loaded.
    Code:
    NewAssetListWindow = function(width, listNode){
                        //windowCounter++;
                        var dialog = new Ext.LayoutDialog("listwindow_" & listNode.id, { 
                            autoCreate: true,
                            modal:false,
                            width:200,
                            height:300,
                            shadow:true,
                            minWidth:300,
                            minHeight:300,
                            proxyDrag: false,
                            title: listNode.id,
    	                    center: {
    	                        autoScroll:true,
    	                        autoCreate: true
    	                    }
                        });
                        dialog.addKeyListener(27, dialog.hide, dialog);
                        
                        var layout = dialog.getLayout();
                        layout.beginUpdate();
    	                var CP = Ext.ContentPanel;
    	                //layout.add('center', new CP() Ext.ContentPanel('center', 'autoCreate: true'));
    	                layout.add("center", new CP(Ext.id(), {title: "Close Me", closable: true, autoCreate: true}));
    	                layout.endUpdate();
    	                
    	                
    	                //do a tree
    	                var windowTree = Ext.tree;
        
                        var windowtree = new windowTree.TreePanel('center', {
                            animate:true, 
                            
                            loader: new windowTree.TreeLoader({dataUrl:'data.aspx', 
                                baseParams: { type: 'folderchildren', guid: '', userguid: ''} 
                            }),
                            enableDD:true,
                            containerScroll: true
                        });
    
                        // set the root node
                        var root = new windowTree.AsyncTreeNode({
                            text: 'My List Directory',
                            draggable:false,
                            //children: new Tree.TreeLoader({dataUrl:'data.aspx?d=1}),
                            id:'source_' & listNode.id
                        });
                        windowtree.setRootNode(root);
    
                        // render the tree
                        windowtree.render();
                        root.expand();
    	                
    	                
    	                dialog.show();
                    }
    Any direction is appreciated.. I would really like to solve this so I can move on.

    -Mac

  2. #2
    Sencha - Ext JS Dev Team Animal's Avatar
    Join Date
    Mar 2007
    Location
    Notts/Redwood City
    Posts
    30,508
    Vote Rating
    56
    Animal has a spectacular aura about Animal has a spectacular aura about Animal has a spectacular aura about

      0  

    Default


    What's this:

    Code:
    "listwindow_" & listNode.id
    ?????

    Have you tried using Firebug to examine the ID of the autogenerated Dialog element?

    Clue: It will not be a string consisting of "listwindow_" + the node id.

    You are performing a bitwise AND operation.

  3. #3
    macm
    Guest

    Default


    Thank you so much! I do use Firebug... but just was not looking at that particular id. Been switching between a lot of dev enviroments lately... so syntax is a little sloppy.

    Thanks again!!!

  4. #4
    Ext User
    Join Date
    May 2007
    Posts
    45
    Vote Rating
    0
    incunix is on a distinguished road

      0  

    Default a little Q about this...

    a little Q about this...


    I was just wondering, is it safer to delete the dialog when you close it rather than hide it if you dont need it anymore and might create many in the future?

    I mean, it cant be any good having loads created in the background!
    n.

Thread Participants: 2