Results 1 to 6 of 6

Thread: Entire app in a div

  1. #1
    Sencha User
    Join Date
    Dec 2011
    Posts
    26
    Vote Rating
    0
      0  

    Default Answered: Entire app in a div

    Hi,

    I would like to wrap the touch application in a div but can't seem to get it working. I've tried autoCreateViewPort set to false and specify renderTo on my outmost component. Can't pull it off.

    Would anyone like to post a snippet to get me started?

    Code:
    <body>
    <div id="hi-wrapper">
    App should render here
    </div>
    </body>
    Many thanks,

    Arjen

  2. Since you have fullscreen to true, it will be added to the Ext.Viewport class and not to your div. If you use renderTo you will need to handle the sizing.

  3. #2
    Sencha - Sr Software Engineer mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    39,320
    Answers
    3883
    Vote Rating
    1293
      0  

    Default

    Have you inspected the DOM? Has the Ext.Viewport covered everything?
    Mitchell Simoens @LikelyMitch
    Sencha Inc, Senior Software Engineer
    ________________
    Learn BBCode and use it!

    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
    Dec 2011
    Posts
    26
    Vote Rating
    0
      0  

    Default

    Hi,

    The DOM looks like this:

    Code:
    <body id="ext-element-3" style="width: 100% !important; height: 100% !important; " class="x-desktop x-macos x-landscape">
    <div id="hi-wrapper">
    </div>
    
    
    <div class="x-container" id="ext-viewport" style="width: 100% !important; height: 100% !important; ">
    (inner elements removed for clarity)
    </div>
    
    </body>
    It is generated by:

    Code:
    Ext.Loader.setConfig({ enabled: true });
    
    
    Ext.require('SBB.view.NavGrid');
    
    
    Ext.application({
        name: 'SBB',
        appPath: 'app',
        autoCreateViewPort: false,
    
    
        initialize: function () {
            this.callParent();
        },    
    
    
        launch: function() {
            var grid = Ext.create('Ext.Panel', {
                fullscreen: true,
                layout: 'vbox',
                renderTo: Ext.Element.get('#hi-wrapper'),
                items: [
                    {
                        dock: 'top',
                        height:169,
                        layout:'hbox',
                        items: [
                            {
                                cls:'logo',
                                width:213
                            },{
                                id:'companion-image',
                                flex:1,
                                html:'<img src="images/ZW-Drenthe.jpg" />'
                            }
                        ]
                    },
                    {
                        dock: 'top',
                        height:100,
                        html: '<h1>Veen to Lauwersmeer</h1>',
                        cls:'locationitem'
                    },
                    {xtype:'navgrid'},
                    {
                        dock:'bottom',
                        height:100
                    }
                ]
            });
        }
    });

  5. #4
    Sencha - Sr Software Engineer mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    39,320
    Answers
    3883
    Vote Rating
    1293
      0  

    Default

    Since you have fullscreen to true, it will be added to the Ext.Viewport class and not to your div. If you use renderTo you will need to handle the sizing.
    Mitchell Simoens @LikelyMitch
    Sencha Inc, Senior Software Engineer
    ________________
    Learn BBCode and use it!

    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.

  6. #5
    Sencha User
    Join Date
    Dec 2011
    Posts
    26
    Vote Rating
    0
      0  

    Default

    Thanks for that.

    There were more things wrong, the spelling of autoCreateViewport should be lowercase 'port' according to the docs. Also, in the renderTo I had to use a document.getElementById since Ext.Element.get is probably deprecated.

    Anyway I got it working, but i noticed that beneath my div hosting the app a viewport was still being generated. I will postpone this part of the app and look in to it another time.

  7. #6
    Sencha - Sr Software Engineer mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    39,320
    Answers
    3883
    Vote Rating
    1293
      0  

    Default

    Ext.get isn't deprecated. Ext.Viewport will always be created.
    Mitchell Simoens @LikelyMitch
    Sencha Inc, Senior Software Engineer
    ________________
    Learn BBCode and use it!

    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.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •