1. #1
    Sencha User
    Join Date
    Jul 2013
    Posts
    3
    Vote Rating
    0
    sigismondmc is on a distinguished road

      0  

    Default Answered: Unable to remove a component from parent container - Sencha Touch in Action

    Answered: Unable to remove a component from parent container - Sencha Touch in Action


    I recently purchased the Sencha Touch in Action and I am stuck in chapter 4 where an attempt is made to remove a component from a container. I get this error: Uncaught TypeError: Cannot call method 'remove' of undefined. I figure its because the container isn't ready at the time the remove function was invoked.
    I decided to test this by both wrapping the code to remove the container in a setTimeout to no avail. Any assistance will be appreciated.

    Link to code:
    https://github.com/ModusCreateOrg/se...container.html

  2. We will have to fix this example as it simply won't work at all. Try this:

    Code:
    Ext.application({
        name : 'Test',
    
        launch : function () {
    
            var loginContainer = Ext.create('Ext.Container', {
                itemId     : 'loginContainer',
                fullscreen : true,
                items      : [
                    {
                        xtype       : 'textfield',
                        label       : 'Login',
                        placeHolder : 'Enter Username Here'
                    },
                    {
                        xtype       : 'textfield',
                        label       : 'Organization',
                        id      : 'orgField',
                        placeHolder : 'Enter Your Organization Here'
                    },
                    {
                        xtype       : 'textfield',
                        label       : 'Password',
                        placeHolder : 'Enter Password Here'
                    }
                ]
            });
    
            var container = Ext.ComponentQuery.query('#loginContainer')[0];
            container.remove(container.child('#orgField'));
    
        }
    });

  3. #2
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    36,754
    Answers
    3462
    Vote Rating
    827
    mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute

      1  

    Default


    We will have to fix this example as it simply won't work at all. Try this:

    Code:
    Ext.application({
        name : 'Test',
    
        launch : function () {
    
            var loginContainer = Ext.create('Ext.Container', {
                itemId     : 'loginContainer',
                fullscreen : true,
                items      : [
                    {
                        xtype       : 'textfield',
                        label       : 'Login',
                        placeHolder : 'Enter Username Here'
                    },
                    {
                        xtype       : 'textfield',
                        label       : 'Organization',
                        id      : 'orgField',
                        placeHolder : 'Enter Your Organization Here'
                    },
                    {
                        xtype       : 'textfield',
                        label       : 'Password',
                        placeHolder : 'Enter Password Here'
                    }
                ]
            });
    
            var container = Ext.ComponentQuery.query('#loginContainer')[0];
            container.remove(container.child('#orgField'));
    
        }
    });
    Mitchell Simoens @SenchaMitch
    Sencha Inc, Senior Forum Manager
    ________________
    Check out my GitHub, lots of nice things for Ext JS 4 and Sencha Touch 2
    https://github.com/mitchellsimoens

    Think my support is good? Get more personalized support via a support subscription. https://www.sencha.com/store/

    Need more help with your app? Hire Sencha Services services@sencha.com

    Want to learn Sencha Touch 2? Check out Sencha Touch in Action that is in print!

    When posting code, please use BBCode's CODE tags.

  4. #3
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    36,754
    Answers
    3462
    Vote Rating
    827
    mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute

      0  

    Default


    A note, I've issued a pull request to fix the code in the git repo so the code will get updated to work: https://github.com/ModusCreateOrg/se...xamples/pull/1

    Thanks for pointing this out!
    Mitchell Simoens @SenchaMitch
    Sencha Inc, Senior Forum Manager
    ________________
    Check out my GitHub, lots of nice things for Ext JS 4 and Sencha Touch 2
    https://github.com/mitchellsimoens

    Think my support is good? Get more personalized support via a support subscription. https://www.sencha.com/store/

    Need more help with your app? Hire Sencha Services services@sencha.com

    Want to learn Sencha Touch 2? Check out Sencha Touch in Action that is in print!

    When posting code, please use BBCode's CODE tags.

  5. #4
    Sencha User
    Join Date
    Jul 2013
    Posts
    3
    Vote Rating
    0
    sigismondmc is on a distinguished road

      0  

    Default


    Thanks for the response. It worked.

Thread Participants: 1

Tags for this Thread

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..."