1. #1
    Sencha User
    Join Date
    Jun 2012
    Posts
    82
    Answers
    7
    Vote Rating
    1
    dr-dan is on a distinguished road

      0  

    Default Answered: When to use (or not) renderTo: document.body

    Answered: When to use (or not) renderTo: document.body


    I am confused (nothing new there then).

    When the following code is in my Ext.applications's launch() override, the form displays correctly

    Code:
    Ext.create('Pegfect.view.profile.LoginForm', {
          renderTo: document.body
        });
    However, when it is in a controller's code, it does not, and no error is reported:

    Am I breaking some unwritten Ext JS law here?

    controller snippet:

    Code:
    init: function () {
     this.onApplicationLoaded();
    }
    
    onApplicationLoaded : function () {
     Ext.create('Pegfect.view.profile.LoginForm', {
          renderTo: document.body
        });
    }
    Or is it more to do with pipeline (sometimes i feel im forever stuck in some asp.net web forms style init, load, render order-of-things-horror-nightmare).

  2. All sorts of things that could be going wrong here. Try this:

    Code:
    onApplicationLoaded : function () {
        console.log(document.body);
    
        Ext.create('Pegfect.view.profile.LoginForm', {
            renderTo: document.body
        });
    }
    This will confirm two things: whether the method is being called and whether or not document.body exists at that point.

  3. #2
    Sencha Premium Member skirtle's Avatar
    Join Date
    Oct 2010
    Location
    UK
    Posts
    3,605
    Answers
    543
    Vote Rating
    326
    skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future

      0  

    Default


    All sorts of things that could be going wrong here. Try this:

    Code:
    onApplicationLoaded : function () {
        console.log(document.body);
    
        Ext.create('Pegfect.view.profile.LoginForm', {
            renderTo: document.body
        });
    }
    This will confirm two things: whether the method is being called and whether or not document.body exists at that point.

Thread Participants: 1