Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to align grid Panel in center

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

like image 974
Ajan Avatar asked Jul 04 '11 10:07

Ajan


People also ask

How do I center my grid display?

To center the <div> element horizontally using grid. Use the property of display set to grid i.e. display: grid; Then use property place-items: center; Example: The following example demonstrates to set the <div> to the center using grid property.


2 Answers

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;'
    })]

});

like image 123
Skym Avatar answered Sep 28 '22 02:09

Skym


In the examples site there is an example that does this you may want to look at.

layout:'ux.center',
items: {
    title: 'Centered Panel',
    widthRatio: 0.75,
    html: 'Some content'
}
like image 36
hpavc Avatar answered Sep 28 '22 03:09

hpavc