0

so Im building a brand new ExtJS 5 application using Sencha CMD 5.1.2.52 with the command sencha generate app MYAPP ../MYAPP

It automatically renders to the body tag, but I would rather render it to a div with the id "#myDiv". I looked for the renderto attribute on several files (views, models, app configuration files, etc) with no luck.

So is there a way to override this behavior? Thanks!

Multitut
  • 2,089
  • 7
  • 39
  • 63

1 Answers1

0

When you build an application with Sencha command, the main container will be a ViewPort and by default every ViewPort is rendered to document.body.

You could remove the autoCreateViewport config, and add a launch object where you would create your panel, example:

Ext.application({
    name: 'MyApp',

    extend: 'MyApp.Application',

    //autoCreateViewport: 'MyApp.view.main.Main'
    launch: function() {
        Ext.create('MyApp.view.main.Main',{
            renderTo: yourDivHere
        });
    }
});
Guilherme Lopes
  • 4,688
  • 1
  • 19
  • 42