Wait! Looks like we don't have enough information to add this to bug database. Please follow this template bug format.
  1. #1
    Touch Premium Member lylepratt's Avatar
    Join Date
    Dec 2010
    Location
    Austin, Texas
    Posts
    159
    Vote Rating
    0
    lylepratt is on a distinguished road

      0  

    Default this.parent and this.getParent() always return undefined in initialize

    this.parent and this.getParent() always return undefined in initialize


    I can't seem to get this.parent or this.getParent() to return anything in initialize. I think this is also causing the up() method to not work in initialize. I could be missing an obvious reason why this doesn't work. If I am, please let me know why this is.

    Example code:
    Code:
    Ext.define('Bv.Template', {
        extend: 'Ext.Container',
        xtype: 'bvtemplate',
        cls: 'bvtemplate',
        layout: "vbox",
        flex: 1,
        config: {
            templateData: {},
            items: [
                {
                    html: "See Console for Output",
                    style: "height: 50px;"
                }
            ]
        },
        initialize: function(config) {
            this.callParent();
            this.on("show", function() {
                console.log("<<<SHOW EVENT")
                console.log(this.parent) // This works
                console.log(this.getParent()) // This works
                console.log(this.up("component")) // This works
            })
            console.log("<<<INSIDE INITIALIZATION")
            console.log(this) // this actually contains a parent object
            console.log(this.parent) // undefined
            console.log(this.getParent()) // undefined
            console.log(this.up("component")) // undefined
        }
    });
    
    
    Ext.application({
        name: 'Bv',
        launch: function() {
            var template = Ext.create("Bv.Template", {
                scrollable: true,
                fullscreen: true,
                templateData: {"test":true}
            });
            console.log("<<<AFTER CREATION")
            console.log(template.parent) // This works
            console.log(template.getParent()) // This works
            console.log(template.up("component")) // This works
        }
    });
    Twitter: lylepratt

  2. #2
    Sencha - Sencha Touch Dev Team Jamie Avins's Avatar
    Join Date
    Mar 2007
    Location
    Redwood City, California
    Posts
    3,661
    Vote Rating
    20
    Jamie Avins is a jewel in the rough Jamie Avins is a jewel in the rough Jamie Avins is a jewel in the rough

      0  

    Default


    I don't think it can be there during initialize. Not sure exactly what you are trying to do though where you'd need it.

    Sencha Inc

    Jamie Avins

    @jamieavins

  3. #3
    Touch Premium Member lylepratt's Avatar
    Join Date
    Dec 2010
    Location
    Austin, Texas
    Posts
    159
    Vote Rating
    0
    lylepratt is on a distinguished road

      0  

    Default


    I basically have some dynamic panels are customized when initialized based on an attribute of a parent panel. Would be nice if it were possible to access the parents when initializing something.
    Twitter: lylepratt

  4. #4
    Sencha - Sencha Touch Dev Team Jamie Avins's Avatar
    Join Date
    Mar 2007
    Location
    Redwood City, California
    Posts
    3,661
    Vote Rating
    20
    Jamie Avins is a jewel in the rough Jamie Avins is a jewel in the rough Jamie Avins is a jewel in the rough

      1  

    Default


    Initialize is really confined to the instance coming up before it is added to a container.

    Sencha Inc

    Jamie Avins

    @jamieavins

  5. #5
    Sencha User
    Join Date
    May 2013
    Posts
    5
    Vote Rating
    1
    lellimecnar is on a distinguished road

      0  

    Default


    So, if I need to add some logic before the component is added to the DOM, based on the config of the parent it's being added to. Where can I add that if I can't get the parent from within initialize? I would expect that to be the case in the constructor method, but I would think that initialize would have that information available.

    The use case is this: I have a "ListTitle" component that I add to a list with ScrollDock: top, among other things. It works fine in most lists, but it's added outside of the scroller if the list is infinite. So, I'm thinking that I need to check if the list it's being added to is infinite, and if it is, then I need to move it inside the scroller.

    I'm very new to Sencha, so I very well may be doing this entirely wrong, but this is how the project was originally written.

Thread Participants: 2

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