how to align grid Panel in center

Ajan picture Ajan · Jul 4, 2011 · Viewed 15k times · Source

I am placing Ext JS Grid Panel in a iFrame. Do anybody know how can I place it in the center of the iFrame.

Currently It look like this - Currently It look like this

I want it to be like this - I want it to be like this

Answer

Skym picture Skym · Jul 4, 2011

The contents of your IFrame can use a border layout as above or no layout, like this:

var viewPort = new Ext.Viewport({
    renderTo:'body',
    width: 400,
    height: 400,
    items:[new Ext.Panel({
        title: 'hi',
        width: 200,
        height: 200,
        style: 'margin:0 auto;margin-top:100px;'
    })]

});