2013-08-06 39 views
0

我有下面的代碼:改變selectfield寬度煎茶

Ext.create('Ext.form.Panel', { 
    fullscreen: true, 
    items: [ 
     { 
      xtype: 'fieldset', 
      title: 'Select', 
      items: [ 
       { 
        xtype: 'selectfield', 
        label: 'Choose one', 
        options: [ 
         {text: 'First Option', value: 'first'}, 
         {text: 'Second Option', value: 'second'}, 
         {text: 'This is a long text to test the selectfield', value: 'third'} 
        ] 
       } 
      ] 
     } 
    ] 
}); 

我想改變selectfield寬度,因爲第三個選項是很長。

回答

1

widthmaxWidth配置。

編輯:

div.x-select-overlay { width: 15em !important } 
+0

是的,但是這會在收縮時改變選擇區寬度。當這些選項被展開時,它將返回到原來的大小 – jos11

+0

在這種情況下,使用大概可以使用CSS: div.x-select-overlay {width:15em!important} –

+0

謝謝我已經使用 .x-select-overlay { 最小寬度:25em!重要; } 它的工作原理 – jos11

-1

我終於有解決了這個:

.x-select-overlay{ 
min-width: 25em !important; 
} 

在app.scss

1

上述結果將覆蓋整個應用程序的選擇域覆蓋。

爲了更加精確和準確,您可以通過在特定的selectfield.eg`中使用選擇字段defaultPhonePickerConfigdefaultTabletPickerConfig來覆蓋寬度或高度屬性。

{ 
    xtype: 'selectfield', 
    defaultPhonePickerConfig: { 
     height: '8em', 
     width:'10em' 
    }, 
    defaultTabletPickerConfig: { 
     height: '8em', 
     width:'10em' 
    }, 
}