How to give padding/margin to items inside the ExtJS panel

38,899

Solution 1

You could use the bodyStyle configuration property:

{
    xtype: 'panel',
    border: false,
    bodyStyle: 'margin: 10px;'
    items: [
        { boxLabel: 'One', xtype: 'checkbox' },
        { boxLabel: 'Two', xtype: 'checkbox' }
    ]
}

Solution 2

In ExtJs 2.3, there is no support for config options "margin, padding" in Ext.Panel.

Check in the documentation http://docs.sencha.com/extjs/2.3.0/#!/api/Ext.Panel

you should go for bodyStyle config option.

{
     xtype: 'panel',
     border: false,
     bodyStyle: 'margin: 10px; padding: 5px 3px;',
     items: [
          { boxLabel: 'One', xtype: 'checkbox' },
          { boxLabel: 'Two', xtype: 'checkbox' }
     ]
}

Hope this helped you.....

Solution 3

Below should also work:

var myForm = new Ext.form.FormPanel ({
title: 'My Form',
width: 400,
height: 250,
padding: '50 10 10 10',
Share:
38,899
Microsoft DN
Author by

Microsoft DN

Updated on July 05, 2022

Comments

  • Microsoft DN
    Microsoft DN almost 2 years

    I am using ExtJS 2.3.0

    I have a panel and some items inside that

    {
        xtype: 'panel',
        border: false,
        margin: '10px;' // Not working for me
        items: [
                { boxLabel: 'One', xtype: 'checkbox' },
                { boxLabel: 'Two', xtype: 'checkbox' }
        ]
    }
    

    I tried using margin, padding... none of them is working for me..

    Any solutions.