2

I'm using border layout in Extjs4.0. It was working fine there. When I upgrade my library to extjs4.1, its showing error like layout run failed, and the panel is not loading. I didn't came across such error, so help me to resolve this error.

My code is

Ext.define('TextFit', {
    extend : 'Ext.container.Container',
    title: 'Sample text',
    layout: {
        type : 'border'
    },
    items : [{
        title : 'left panel',
        region : 'west'
    },{
        title : 'Center panel',
        region: 'center'
    }]
});

Thanks in advance.

Boopathy
  • 367
  • 1
  • 7
  • 16
  • 1
    I ran this code but I didn't get any error. When you get this error? – Wilk Sep 17 '12 at 17:41
  • Maybe you can look at this answer that explain why a layout can fail: [link](http://stackoverflow.com/questions/11533769/understanding-layout-run-failure-error-logging) – Valentino Dell'Aica Nov 26 '12 at 08:31

5 Answers5

11

Try adding

layout: 'fit'

To your border layout's parent container. I had the same problem and this solved it for me.

Brett
  • 2,775
  • 4
  • 27
  • 32
2

From BorderLayout's documentation:

  • Any child items with a region of west or east may be configured with either an initial width, or a Ext.layout.container.Box.flex value, or an initial percentage width string (Which is simply divided by 100 and used as a flex value). The 'center' region has a flex value of 1.

Similarly for north and south, but height instead of width.

David Easley
  • 1,347
  • 1
  • 16
  • 24
1

i had this problem while trying to add a complex set of (deep nested) items to a panel before rendering the panel. Once i added the items after the panel knew it's dimensions, it worked:

addItems: function() {
    this.on("boxready", function(){ this.add(items); }, this, {single: true});  
}
0

Try to add flex property to both items ... so the modified code will be

....

items : [{
    title : 'left panel',
    region : 'west',
flex:1 //add here
},{
    title : 'Center panel',
    region: 'center',
flex:1 //and here
}]

......

ram mere
  • 215
  • 5
  • 17
0

You could try using:

 <script type="text/javascript" src="extjs/src/diag/layout/Context.js"></script>
 <script type="text/javascript" src="extjs/src/diag/layout/ContextItem.js"></script>

just put this in your index.html and check the console to see if there are any errors in there. Don't mind most of the warnings you see.

If there are errors like: "... is still connected/attached" then look at that item and make sure it has a layout other than anchor.

If you don't have any errors in the console and there is still a layout issue, you could try using the page analyzer.

You should be able to find the analyser in your extjs zip. If it is deployed on your server you could go to: http://< server-address >/extjs/examples/page-analyzer/page-analyzer.html

Mike
  • 1,003
  • 1
  • 11
  • 23