1. #1
    Sencha User
    Join Date
    Jan 2012
    Location
    London, UK
    Posts
    497
    Answers
    25
    Vote Rating
    51
    shepsii has a spectacular aura about shepsii has a spectacular aura about shepsii has a spectacular aura about

      0  

    Default Answered: Quick question on Component.render

    Answered: Quick question on Component.render


    Hi guys,

    Getting confused with this.render in the context of a controller (oops typo in the topic title, meant controller.render()).

    My understanding was that on a controller, calling:
    Code:
    this.render({
    xtype: 'myviewxtype'
    });
    would create a new instance of the component of that xtype, and then add it to the render target of the controller as an item.

    If it's not doing this, what does this.render do exactly? I've read somewhere that it's not compatible with a card layout. What if I need to use a card layout (am using a TabPanel) - how do I add items to that TabPanel from my controller if this.render doesn't do that?

    Many thanks

  2. I would just do tabpanel.add({ xtype : '...' }) or tabpanel.setActiveItem({ xtype : '...' }), I have never used this.render as I don't see a need for it.

  3. #2
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    36,633
    Answers
    3452
    Vote Rating
    817
    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


    I would just do tabpanel.add({ xtype : '...' }) or tabpanel.setActiveItem({ xtype : '...' }), I have never used this.render as I don't see a need for it.
    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 User
    Join Date
    Jan 2012
    Location
    London, UK
    Posts
    497
    Answers
    25
    Vote Rating
    51
    shepsii has a spectacular aura about shepsii has a spectacular aura about shepsii has a spectacular aura about

      0  

    Default


    Thanks Mitchell, that's what I'd defaulted to for the time being. I'd seen it in a few tutorials so was afraid that it was best practice that I needed to use...

Thread Participants: 1