簡體   English   中英

如何在Extjs中將圖像添加到組合?

[英]How do I add an image to a combo in Extjs?

我設法在extjs組合選擇列表中添加了一個圖像,但是在選擇一個項目后,在折疊組合中並沒有顯示相同的圖像。 我嘗試通過添加一些自定義HTML來更改模板(displayTpl),但是它將被轉義。 任何幫助,將不勝感激。

謝謝

   this.chartCombo = Ext.create('Ext.form.field.ComboBox', {
        height: '20',
        fieldLabel: 'Chart Type',
        displayField: 'chartLabel',
        valueField: 'chartValue',
        store: chartComboDataSource,
        queryMode: 'local',
        listConfig: {
            getInnerTpl: function() {
                this.cls = 'option-list-chart-img';
                return "<img class='{cssClassName}'/> {chartLabel}";
            }
        }
    });

這是行不通的,因為折疊的組合只是一個簡單的<input>元素,不能包含HTML。 我建議您將圖像設置為<input>的背景圖像,並在選擇更改時以編程方式對其進行切換。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM