tags:

views:

717

answers:

3

Hi there,

I'm using extjs and just trying to solve a simple problem: I have a form with a fixed width. I want to Center this form within a normal Ext.Panel. I'm trying to achieve this the 'css-way' - setting the left and right margin to 'auto'.

But this doesn' work, it seems the margins are just ignored.

The Code:

    var curStateForm = new Ext.FormPanel({
        title:'test',
        width:300,
bodyStyle:'margin:5px auto 0 auto',
items: [edIst, edAdjust, edSumme]

});

var testPanel = new Ext.Panel({ width: '100%', frame:true, items:[curStateForm] });

Thx to all!

A: 

Try the following in the panel:

style: {
    "margin-left": "auto",
            "margin-right": "auto"
       }, 
Natkeeran
Tried this, but it didn't worked...
Ben
+1  A: 

Have you seen this sample? Look at the example under "custom layouts / center"

bmoeskau
Thanks, didn't found that but I think thats what I'm looking for ;)
Ben
A: 

In panel:

bodyStyle: "padding: 15px;"  // may also be only padding-left/right
Thevs
Tried this, but it didn't worked...
Ben