2015-02-06 76 views
0

我的代碼:CSS樣式

{ 
    border: 1, 
    bodyStyle: 'margin:0 0 0 140px;', 
    style: { 
    borderColor: 'black', 
    borderStyle: 'solid', //margin:'0 0 0 140' //margin-left: '140px' }, width: 140, name: 'comp', id:'compId', triggerAction: 'all', mode: 'local', store: new Ext.data.SimpleStore({ 
    fields: ['myId', 'displayText'], 
    data: [ 
     [1, 'item1'], 
     [2, 'item2'] 
    ] 
    }), displayField: 'displayText', xtype: 'combo', 
}, 

這裏的Ext JS 2.3 bodyStyle不獲取附加到combobox.Can任何建議如何解決這個問題?

謝謝

回答

0

我認爲這可能是你需要的。

{ 
    xtype: 'combo' 
    style : 'margin-left: 140px; border: solid black 1px;', 
    name: 'comp', 
    id:'compId', 
    triggerAction: 'all', 
    mode: 'local', 
    store: new Ext.data.SimpleStore({ 
     fields: ['myId', 'displayText'], 
     data: [ 
      [1, 'item1'], 
      [2, 'item2'] 
     ] 
     }), 
    displayField: 'displayText', 
    valueField : 'myId' 

} 

注有根據文檔沒有bodyStyle配置選項 - http://docs.sencha.com/extjs/2.3.0/#!/api/Ext.form.ComboBox

我刪除寬度的選擇,因爲與保證金左style屬性(也140px),我想你可能最終得到一些奇怪看着。

+0

這不是在我的情況幫忙。我有一個文本框,並內聯到它即將放置此組合框。 – user2940383 2015-02-09 04:56:13

+0

我有{xtype:'textfield',value:「comboValue」,width:140px}並使用上面的代碼在它旁邊放置了一個combox框,所以我想將margin-style應用到bodyStyle而不是內部元素。 bodyStyle會將樣式應用於整個組合框,樣式元素將應用於其內部元素,即文本。 – user2940383 2015-02-09 05:04:15

+0

你可以發佈你的整個代碼,所以我可以確切地看到你正在試圖實現你的領域的佈局?這聽起來像你試圖把一個texfield放在一個組合框中,正如你所說的將它放在內聯中,我不認爲你可以用ExtJS – mindparse 2015-02-09 10:16:28

0

combo.js:

{xtype:'combobox', cls:'combo'} 

combo.css:

.combo .x-boundlist-selected { 
    background: #757575; 
    background-image: -webkit-linear-gradient(top, #757575, #474747); 
    background-image: -moz-linear-gradient(top, #757575, #474747); 
    background-image: -ms-linear-gradient(top, #757575, #474747); 
    background-image: -o-linear-gradient(top, #757575, #474747); 
    background-image: linear-gradient(to bottom, #757575, #474747); 
    border: solid #4e4e4e 2px; 
    color: #ffffff; 
    text-decoration: none; 
} 

.combo .x-boundlist-item { 
    background: #757575; 
    background-image: -webkit-linear-gradient(top, #757575, #474747); 
    background-image: -moz-linear-gradient(top, #757575, #474747); 
    background-image: -ms-linear-gradient(top, #757575, #474747); 
    background-image: -o-linear-gradient(top, #757575, #474747); 
    background-image: linear-gradient(to bottom, #757575, #474747); 
    border: solid #4e4e4e 2px; 
    color: #ffffff; 
    text-decoration: none; 
}