2013-08-01 50 views
0

我想顯示3個複選框:多個複選框僅示出一個

var DescCheck = new Ext.form.Checkbox({ 
         fieldLabel: 'Description of service : <span style="color: rgb(255, 0, 0); padding-left: 2px;">*</span>', 
         width : 600, 
         labelSeparator : '', 
         items: [ 
          {boxLabel: 'Direct', name: 'Direct', inputValue: 'Direct'}, 
          {boxLabel: 'Fixed-day', name: 'day', inputValue: 'Fixed'}, 
          {boxLabel: 'Weekly', name: 'Weekly', inputValue: 'Weekly'} 
         ] 
}); 

這form.Checkbox處於字段(純粹審美),其是在一個Ext.FormPanel。

這是發生了什麼:顯示 checkbox

只有一個複選框,沒有任何標籤。爲什麼?

回答

2

您正在使用Checkbox,當它看起來像你想要的是一個CheckboxGroup。對於V4.2.1,這裏是文檔此:其他http://docs.sencha.com/extjs/4.2.1/#!/api/Ext.form.CheckboxGroup

var descCheck = new Ext.form.CheckboxGroup({ 
    ... 
    items: [ 
     {boxLabel: 'Direct', name: 'Direct', inputValue: 'Direct'}, 
     {boxLabel: 'Fixed-day', name: 'day', inputValue: 'Fixed'}, 
     {boxLabel: 'Weekly', name: 'Weekly', inputValue: 'Weekly'} 
    ] 
}); 

有一點要注意,你應該總是命名變量開始以小寫字母(descCheck而不是DescCheck)。

相關問題