1. #1
    Sencha User
    Join Date
    Feb 2009
    Posts
    38
    Vote Rating
    0
    col is on a distinguished road

      0  

    Default Problems with add->remove->add component in Window

    Problems with add->remove->add component in Window


    There is such a decisive way the problem with the content of the form (with fields).
    here http://extjs.com/forum/showthread.ph...975#post323975
    In my case the problem relates to the content window.

    This example does not work as expected.
    PHP Code:
    var window = new Ext.Window( {
        
    width       300
        
    ,height     300
        
    ,layout     'fit'
        
    ,buttons:[{
          
    text 'Add Form'
          
    ,handler : function() {
            
    window.add(form);
            
    window.doLayout();
          }
        },{
          
    text 'Del Form'
          
    ,handler : function() {
            
    window.removeAll()
            
    window.doLayout();
          }
        }]

    } );

    var 
    form = new Ext.form.FormPanel( {
        
    labelWidth 150
        
    ,items:[{fieldLabel:'testLabel'xtype:'textfield'value:'testValue'}]
    });

    window.show(); 
    After little voodoo, something that worked.

    Code:
    var window = new Ext.Window( {
        width       : 350
        ,height     : 300
        ,layout     : 'fit'
        ,buttons:[{
          text : 'Add Form'
          ,handler : function() {
            window.add(form);
            window.doLayout();
          }
        },{
          text : 'Del Form'
          ,handler : function() {
            window.removeAll();
            window.doLayout();
            
            form.rendered=false;
            form.items.each(function(item){item.rendered=false});
            form.tools=false;
          }
        }]
    
    } );
    
    var form = new Ext.form.FormPanel( {
        labelWidth : 150
        ,items:[{fieldLabel:'testLabel', xtype:'textfield', value:'testValue'}]
    });
    
    window.show();
    Help me do this correctly.

  2. #2
    jay@moduscreate.com's Avatar
    Join Date
    Mar 2007
    Location
    Frederick MD, NYC, DC
    Posts
    16,353
    Vote Rating
    79
    jay@moduscreate.com is a name known to all jay@moduscreate.com is a name known to all jay@moduscreate.com is a name known to all jay@moduscreate.com is a name known to all jay@moduscreate.com is a name known to all jay@moduscreate.com is a name known to all

      0  

    Default


    you *should not* and *can not* overwrite the window constant.

    That said:

    - removeAll destroy objects
    - No need to call doLayout on remove

    try this:
    Code:
    var buildForm = function() {
    
       return new Ext.form.FormPanel( {
        labelWidth : 150
        ,items:[{fieldLabel:'testLabel', xtype:'textfield', value:'testValue'}]
       });
    
    }
    
    var w = new Ext.Window( {
        width       : 300
        ,height     : 300
        ,layout     : 'fit'
        ,buttons:[{
          text : 'Add Form'
          ,handler : function() {
            w.add(buildForm());
            w.doLayout();
          }
        },{
          text : 'Del Form'
          ,handler : function() {
            w.removeAll();
            w.doLayout();
          }
        }]
    
    } );
    
    
    w.show();

  3. #3
    Sencha User
    Join Date
    Feb 2009
    Posts
    38
    Vote Rating
    0
    col is on a distinguished road

      0  

    Default


    WoW.... Big Tnx

    And how does it work?
    The examples differ only way to create a form variable.

  4. #4
    jay@moduscreate.com's Avatar
    Join Date
    Mar 2007
    Location
    Frederick MD, NYC, DC
    Posts
    16,353
    Vote Rating
    79
    jay@moduscreate.com is a name known to all jay@moduscreate.com is a name known to all jay@moduscreate.com is a name known to all jay@moduscreate.com is a name known to all jay@moduscreate.com is a name known to all jay@moduscreate.com is a name known to all

      0  

    Default


    it works by recreating the form.

  5. #5
    Sencha User
    Join Date
    Mar 2009
    Posts
    356
    Vote Rating
    0
    koko2589 is on a distinguished road

      0  

    Default


    if removeall dont work add this its sloved it
    Code:
    Ext.override(Ext.Container, {
        removeAll: function(autoDestroy){
            this.initItems();
            var item, rem = [], items = [];
            this.items.each(function(i){
                rem.push(i)
            });
            for (var i = 0, len = rem.length; i < len; ++i){
                item = rem[i];
                this.remove(item, autoDestroy);
                if(item.ownerCt !== this){
                    items.push(item);
                }
            }
            return items;
        }
    });
    my ext js site
    http://www.itoto4.com/

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

      0  

    Default


    This very issue is being discussed in the Bugs folder right now.

  7. #7
    Sencha User
    Join Date
    Feb 2009
    Posts
    38
    Vote Rating
    0
    col is on a distinguished road

      0  

    Default


    To koko2589.
    fix, does not help

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

      0  

    Default


    Override the isValidParent method of the layout that you use to return false

  9. #9
    Sencha User
    Join Date
    Feb 2009
    Posts
    38
    Vote Rating
    0
    col is on a distinguished road

      0  

    Default


    Quote Originally Posted by Animal View Post
    Override the isValidParent method of the layout that you use to return false
    sample code pls

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

      0  

    Default


    pls

Turkiyenin en sevilen filmlerinin yer aldigi xnxx internet sitemiz olan ve porn sex tarzi bir site olan mobil porno izle sitemiz gercekten dillere destan bir durumda herkesin sevdigi bir site olarak tarihe gececege benziyor. Sitenin en belirgin ozelliklerinden birisi de Turkiyede gercekten kaliteli ve muntazam, duzenli porno izle siteleri olmamasidir. Bu yuzden iste. Ayrica en net goruntu kalitesine sahip adresinde yayinlanmaktadir. Mesela diğer sitelerimizden bahsedecek olursak, en iyi hd porno video arşivine sahip bir siteyiz. "The Best anal porn videos and slut anus, big asses movies set..." hd porno faketaxi