2014-01-22 15 views
4

我使用ExtJS 2.3.0如何給填充/保證金的ExtJS的面板內的項目

我有一個面板和內部的

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

一些項目我試着用的margin,padding ......沒有的他們正在爲我工​​作..

任何解決方案。

回答

7

您可以使用bodyStyle配置屬性:

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

ExtJS的2.3,存在Ext.Panel的配置選項不支持「的margin,padding」

檢查文檔http://docs.sencha.com/extjs/2.3.0/#!/api/Ext.Panel

在你應該去bodyStyle配置選項。

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

希望這有助於你.....

+0

+1感謝您的文檔鏈接 –