Results 1 to 5 of 5

Thread: Ext.layout.container.Border : css : height : 0px

  1. #1
    Sencha User
    Join Date
    Feb 2012
    Posts
    5
    Vote Rating
    0
      0  

    Default Answered: Ext.layout.container.Border : css : height : 0px

    Newer in extjs, i have an issue when trying to create a new mvc view.
    the <div> are created but the style height = 0px;

    HTML Code:
     <div id="panel-1036" class="x-panel x-box-item x-panel-default" style="margin-left: 0px; margin-bottom: 0px; margin-right: 0px; margin-top: 0px; width: 225px; height: 0px; left: 0px; top: 0px; " role="presentation" aria-labelledby="component-1042">
    step 1 : i define a viewport (layout:border), with 2 items (menuPanel and mainPanel)
    Code:
     
    Ext.define('Viewport', {  
      extend: 'Ext.container.Viewport',  
      initComponent: function(){ 
         Ext.apply(this, {  
           layout: 'border',  
           padding: 5,  
          items: [  
              {region:'west' ,xtype:'panel' ,...},   
              {region:'center' ,xtype:'panel' ,...}  
           ] });
      } };
    step 2 : i define a mvc view : (layout:border), with 2 items (formPanel,gridPanel).

    Code:
      Ext.define('userlist', 
    {  extend : 'Ext.panel.Panel',  initComponent: function(){ Ext.apply(this, { 
     layout: 'border', 
     padding: 5, 
     items: [  {region:'east' ,xtype:'panel' ,...},   {region:'center' ,xtype:'panel' ,...}  ] 
    }}});
    step 3 : after fireevent on a menu item selected, i do
    Code:
     
    var content = Ext.widget('userlist'); mainpanel.removeAll(); mainpanel.add(content)
    the result is that : tags <div> are generated but the height style attribute param is equal to 0px. I would like to know if you know how the height could be adjust automatically? I make some test with

    Code:
     content.setHeight(mainpanel.getHeight())
    but the size is set one time but no more when window resize bubbling An other test with content.doLayout() but in this case the height is still 0. Hope you could help me thanks in advance

  2. Ok... two issues.

    First in your userList class, createFormPanel isn't returning anything.

    Second, you need to use something like layout : 'fit' on the mainpanel. This will tell userList to fit to it's dimensions. autoHeight on mainpanel probably isn't doing much.

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

    Default

    Is the mainpanel the Viewport class you defined?
    Mitchell Simoens @LikelyMitch
    Sencha Inc, Senior Software Engineer
    ________________
    Learn BBCode and use it! Checkout the CODE tag!

    Check out my GitHub, lots of nice things for Ext JS and Sencha Touch
    https://github.com/mitchellsimoens

  4. #3
    Sencha User
    Join Date
    Feb 2012
    Posts
    5
    Vote Rating
    0
      0  

    Default

    nop i dont think so.

    here how i define the viewport

    Code:
    Ext.define('AC.view.Viewport', {
        extend: 'Ext.container.Viewport',
       initComponent: function(){
    
            Ext.define('Menu', {
                extend: 'Ext.data.Model',
                fields: ['title']
            });
    
            Ext.apply(this, {
                layout: 'border',
                padding: 5,
                items: [this.createMenuPanel(), this.createMainPanel()]
            });
            this.callParent(arguments);
        },
    
           createMenuPanel: function(){
            this.menupanel = Ext.create('widget.menupanel', {
                region: 'west',
                title: 'Menu',
                xtype:'panel',
                autoHeight:true,
           }
          });
          return this.menupanel;
       },
    
          createMainPanel: function(){
            this.mainpanel = Ext.create('widget.mainpanel', {
                region: 'center',
                xtype:'panel',
                layout:'fit',
                minWidth: 300,
            });
            return this.mainpanel;
        },
    
        onMenuSelect: function(feed, menu){
                var content = Ext.widget('userlist');
                this.mainpanel.removeAll();
                this.mainpanel.add(content);
       }
    }
    and the userlist
    Code:
    Ext.define('AC.view.userList', {
        extend   : 'Ext.panel.Panel',
        alias    : 'widget.userlist',
    
       initComponent: function(){
    
            Ext.apply(this, {
                layout: 'border',
                autoHeight:true,
                padding: 5,
                items: [this.createGridPanel(),this.createFormPanel()]
            });
            this.callParent(arguments);
        },
    
        createFormPanel: function(){
            this.formpanel = Ext.create('Ext.panel.Panel', {
                region: 'east',
                xtype:'panel',
                autoHeight:true,
         }
         return this.formpanel;
       },
    
        createGridPanel: function(){
            this.gridpanel = Ext.create('Ext.panel.Panel', {
                region: 'center',
                xtype:'panel',
                minWidth: 300,
                autoHeight:true,
            });
            return this.gridpanel;
        },
    });
    thanks to have a look

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

    Default

    Ok... two issues.

    First in your userList class, createFormPanel isn't returning anything.

    Second, you need to use something like layout : 'fit' on the mainpanel. This will tell userList to fit to it's dimensions. autoHeight on mainpanel probably isn't doing much.
    Mitchell Simoens @LikelyMitch
    Sencha Inc, Senior Software Engineer
    ________________
    Learn BBCode and use it! Checkout the CODE tag!

    Check out my GitHub, lots of nice things for Ext JS and Sencha Touch
    https://github.com/mitchellsimoens

  6. #5
    Sencha User
    Join Date
    Feb 2012
    Posts
    5
    Vote Rating
    0
      0  

    Default

    OK you give the good answer !
    -the mainpanel need a layout fit.
    (and add the return into createFormPanel)

    correction are directly made in the previous code section

    thanks to be there. And could you tell me how to close this thread please?
    And as you say to clean a little the code, the param autoHeight seems no to be need.
    take care

Tags for this Thread

Posting Permissions

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