Home > DeveloperSection > Forums > Extjs - How to set items margins and paddings?
John Brown
John Brown

Total Post:6

Points:42
Posted on    May-04-2016 1:24 AM

 sencha extjs JavaScript  Sencha  Sencha Cmd 
Ratings:


 1 Reply(s)
 362  View(s)
Rate this:
I am new in ExtJS environment. My problem is how can I set magins and paddings in our form.
Below I have provided my code: I have created a panel with some items :
{
    xtype: 'panel',
    margin: '20px;' // this margin is not working for me
    items: [
         {
            boxLabel: 'First Check',
            xtype: 'checkbox'
         }, {
            boxLabel: 'Second Check',
            xtype: 'checkbox'
         }]
}
I tried using margins and padding but none of them is working for me.
Please provide me the solution. 
Thank you.


Tarun Kumar

Total Post:210

Points:1614
Posted on    May-13-2016 12:12 AM

You can set the margin and padding of the panel using the bodyStyle: property. In the bodyStyle property we can define both of them together. below I have provided an example on your code:
{
    xtype: 'panel',
    bodyStyle: 'margin: 10px; padding: 10px 5px;',
    items: [
         {
            boxLabel: 'First Check',
            xtype: 'checkbox'
         }, {
            boxLabel: 'Second Check',
            xtype: 'checkbox'
         }]
}
I hope it will be helpful for you.

Modified On May-13-2016 12:12:58 AM

Don't want to miss updates? Please click the below button!

Follow MindStick