2012-01-02 45 views
6

我有問題,在收音機組中設置每個單選按鈕的寬度。ExtJS 3.4 Radiogroup strech關閉

xtype: 'container', 
id: 'cntCompany', 
layout: 'hbox', 
fieldLabel: 'Company', 
items: [ 
    { 
     xtype: 'radiogroup', 
     id: 'rdogrpCompany', 
     items: [ 
      { id: 'rdoIT', boxLabel: 'IT', name: 'rdoCompany', inputValue: 'IT', width: 40, checked: true }, 
      { id: 'rdoCOMMS', boxLabel: 'COMMS', name: 'rdoCompany', width: 40, inputValue: 'Comms' }, 
      { id: 'rdoGROUP', boxLabel: 'GROUP', name: 'rdoCompany', width: 40, inputValue: 'Group' }, 
      { id: 'rdoALL', boxLabel: 'ALL', name: 'rdoCompany', width: 40, inputValue: 'All', margins: '0 0 0 30' } 
     ] 
    } 
] 

我設置了每個單選按鈕的寬度,但它無法正常工作。 爲什麼這個radiogroup strech寬度列相同並忽略寬度:40? 我如何設置每個單選按鈕的寬度?

+0

我認爲這是由你選擇的佈局造成的。它似乎覆蓋子項寬度。但這只是一個猜測... – sra 2012-01-03 12:50:01

+0

@sra我認爲這不是一個佈局問題,因爲單選按鈕寬度工作正常,沒有無線電組。 – ShootingStar 2012-01-03 14:28:37

回答

7

默認情況下,Combo-Group/Radio-Group使用列布局來對齊分組元素。如果沒有其他設置,則使用'auto'作爲默認值。

的控制將在一行和寬度各列的 將根據 總體字段容器的寬度均勻地分佈呈現每列一個。這是默認設置。

基於API它是一個佈局問題。請注意,如果您未定義ExtJS,ExtJS將使用默認佈局。因此,改變佈局或嘗試如果columns: 1解決您的問題。

API-Link

編輯: 基於註釋的正確答案是columns: [40, 40, 40, 40]

+0

謝謝@sra。我在Ext Designer中試過'columns:1',但我不能輸入1.它看起來像一個bug。當然,它可以在手動編輯後生效。對於其他人,我想給每個單選按鈕的寬度。列:1不是我想要的答案,因爲它使垂直單選按鈕數組。答案將是'列:[40,40,40,40]'。再次感謝你 – ShootingStar 2012-01-03 22:34:36