2017-07-04 67 views
0

對於這些checkboxgroups - Unaligned checkboxes對齊不同的複選框組

我要對齊它們看起來像這些checkboxgroups - Aligned checkboxes

下面的代碼是我這麼遠

{ 
     xtype: 'fieldset', 
     title: 'Add to Descriptors', 
     items: [ 
      { 
       xtype: 'checkboxgroup', 
       items: [ 
        {boxLabel: '1.1', name: ''}, 
        {boxLabel: '1.2', name: ''}, 
        {boxLabel: '1.3', name: ''}, 
        {boxLabel: '1.4', name: ''}, 
        {boxLabel: '1.5', name: ''}, 
        {boxLabel: '1.6', name: ''} 
       ] 
      }, 
      { 
       xtype: 'checkboxgroup', 
       items: [ 
        {boxLabel: '2.1', name: ''}, 
        {boxLabel: '2.2', name: ''}, 
        {boxLabel: '2.3', name: ''}, 
        {boxLabel: '2.4', name: ''}, 
        {boxLabel: '2.5', name: ''}, 
        {boxLabel: '2.6', name: ''} 
       ] 
      } 
     ] 
} 

需要添加什麼?

+0

您的圖片無法訪問。你能檢查一下嗎?如果可能的話創建一​​個小提琴。 – UDID

+0

嗯,這很奇怪,不明白爲什麼他們不會。 – DeputyDildog

+0

現在我可以看到。 – UDID

回答

1

爲了實現它,你需要給固定寬度所有複選框和佈局應該hbox

Ext.application({ 
 
    name: 'Fiddle', 
 
    launch: function() { 
 
    Ext.create('Ext.form.Panel', { 
 
     title: 'Checkbox Group', 
 

 
     bodyPadding: 10, 
 
     renderTo: Ext.getBody(), 
 
     items: [{ 
 
     xtype: 'fieldset', 
 
     title: 'Add to Descriptors', 
 
     items: [{ 
 
      xtype: 'checkboxgroup', 
 
      layout: 'hbox', 
 
      defaults: { // defaults are applied to items, not the container 
 
       width: 75 
 
      }, 
 
      items: [{ 
 
       boxLabel: '1.1', 
 
       name: '' 
 
       }, 
 
       { 
 
       boxLabel: '1.2', 
 
       name: '' 
 
       }, 
 
       { 
 
       boxLabel: '1.3', 
 
       name: '' 
 
       }, 
 
       { 
 
       boxLabel: '1.4', 
 
       name: '' 
 
       }, 
 
       { 
 
       boxLabel: '1.5', 
 
       name: '' 
 
       }, 
 
       { 
 
       boxLabel: '1.6', 
 
       name: '' 
 
       } 
 
      ] 
 
      }, 
 
      { 
 
      xtype: 'checkboxgroup', 
 
      layout: 'hbox', 
 
      defaults: { // defaults are applied to items, not the container 
 
       width: 75 
 
      }, 
 
      items: [{ 
 
       boxLabel: '2.1', 
 
       name: '' 
 
       }, 
 
       { 
 
       boxLabel: '2.2', 
 
       name: '' 
 
       }, 
 
       { 
 
       boxLabel: '2.3', 
 
       name: '' 
 
       }, 
 
       { 
 
       boxLabel: '2.4', 
 
       name: '' 
 
       }, 
 
       { 
 
       boxLabel: '2.5', 
 
       name: '' 
 
       }, 
 
       { 
 
       boxLabel: '2.6', 
 
       name: '' 
 
       } 
 
      ] 
 
      }, 
 

 
      { 
 
      xtype: 'checkboxgroup', 
 
      layout: 'hbox', 
 
      defaults: { // defaults are applied to items, not the container 
 
       width: 75 
 
      }, 
 
      items: [{ 
 
       boxLabel: '3.1', 
 
       name: '' 
 
       }, 
 
       { 
 
       boxLabel: '3.2', 
 
       name: '' 
 
       }, 
 
       { 
 
       boxLabel: '3.3', 
 
       name: '' 
 
       }, 
 
       { 
 
       boxLabel: '3.4', 
 
       name: '' 
 
       }, 
 
       { 
 
       boxLabel: '3.5', 
 
       name: '' 
 
       }, 
 
       { 
 
       boxLabel: '3.6', 
 
       name: '' 
 
       }, 
 
       { 
 
       boxLabel: '3.7', 
 
       name: '' 
 
       } 
 
      ] 
 
      }, 
 
      { 
 
      xtype: 'checkboxgroup', 
 
      layout: 'hbox', 
 
      defaults: { // defaults are applied to items, not the container 
 
       width: 75 
 
      }, 
 
      items: [{ 
 
       boxLabel: '4.1', 
 
       name: '' 
 
       }, 
 
       { 
 
       boxLabel: '4.2', 
 
       name: '' 
 
       }, 
 
       { 
 
       boxLabel: '4.3', 
 
       name: '' 
 
       }, 
 
       { 
 
       boxLabel: '4.4', 
 
       name: '' 
 
       }, 
 
       { 
 
       boxLabel: '4.5', 
 
       name: '' 
 
       }, 
 
       { 
 
       boxLabel: '4.6', 
 
       name: '' 
 
       } 
 
      ] 
 
      }, 
 
      { 
 
      xtype: 'checkboxgroup', 
 
      layout: 'hbox', 
 
      defaults: { // defaults are applied to items, not the container 
 
       width: 75 
 
      }, 
 
      items: [{ 
 
       boxLabel: '5.1', 
 
       name: '' 
 
       }, 
 
       { 
 
       boxLabel: '5.2', 
 
       name: '' 
 
       }, 
 
       { 
 
       boxLabel: '5.3', 
 
       name: '' 
 
       }, 
 
       { 
 
       boxLabel: '5.4', 
 
       name: '' 
 
       }, 
 
       { 
 
       boxLabel: '5.5', 
 
       name: '' 
 
       }, 
 
       { 
 
       boxLabel: '5.6', 
 
       name: '' 
 
       } 
 
      ] 
 
      }, 
 
      { 
 
      xtype: 'checkboxgroup', 
 
      layout: 'hbox', 
 
      defaults: { // defaults are applied to items, not the container 
 
       width: 75 
 
      }, 
 
      items: [{ 
 
       boxLabel: '6.1', 
 
       name: '' 
 
       }, 
 
       { 
 
       boxLabel: '6.2', 
 
       name: '' 
 
       }, 
 
       { 
 
       boxLabel: '6.3', 
 
       name: '' 
 
       }, 
 
       { 
 
       boxLabel: '6.4', 
 
       name: '' 
 
       }, 
 
       { 
 
       boxLabel: '6.5', 
 
       name: '' 
 
       }, 
 
      ] 
 
      }, 
 
     ] 
 
     }] 
 
    }); 
 
    } 
 
});
<link rel="stylesheet" href="https://cdn.sencha.com/ext/gpl/4.1.1/resources/css/ext-all.css"> 
 
<script type="text/javascript" src="https://cdn.sencha.com/ext/gpl/4.1.1/ext-all-debug.js"></script>

+0

這工作!非常感謝你。 – DeputyDildog