2013-07-24 56 views
2

ExtJs 4 combobox with checkboxes煎茶建築師2 - ExtJS的組合框4.2.1與複選框

其實我試過,但不是爲我工作。請幫助。

我正在使用sencha架構師添加了一個組合框,然後在configpanel中添加了「Process Config」來實現上面提到的鏈接。

me.processMyComboBox({ 
         xtype: 'combobox', 
         labelAlign: 'top', 
         value: [ 
          'Friends', 
          'Trusted' 
         ], 
         forceSelection: true, 
         multiSelect: true, 
         store: [ 
          'Friends', 
          'Family', 
          'Following', 
          'Trusted', 
          'Office' 
         ] 
        }) 

processMyComboBox: function(config) {   
    config.listConfig = { 
     getInnerTpl : function() { 
      return '<div class="x-combo-list-item"><img src="" class="chkCombo-default-icon chkCombo" /> {fieldName} </div>'; 
     }  
    };   
    return config; 
} 

應用上述配置後,組合框變爲空白。

我試圖張貼截圖,但因爲我沒有10個聲望,所以我不能。

感謝, 阿里阿巴斯

回答

2

我終於解決了上述問題。回答以防萬一其他人有同樣的問題。其實我使用了錯誤的佔位符。只需添加displayField參數getInnerTpl函數。

processMyComboBox: function(config) {   
config.listConfig = { 
    getInnerTpl : function() { 
     return '<div class="x-combo-list-item"><img src="" class="chkCombo-default-icon chkCombo" /> {fieldName} </div>'; 
    }  
};   
return config; 

}

OR
更合適的方式是,而不是添加processMyComboBox功能只需添加listConfig屬性如下

xtype: 'combobox', 
         listConfig: { 
          getInnerTpl: function(displayField) { 
           return '<div class="x-combo-list-item"><img src="" class="chkCombo-default-icon chkCombo" /> {'+ displayField +'}</div>'; 
          } 
         }, 
         labelAlign: 'top', 
         value: [ 
          'Friends', 
          'Trusted' 
         ], 
         displayField: 'name', 
         forceSelection: true, 
         multiSelect: true, 
         store: [ 
          'Friends', 
          'Family', 
          'Following', 
          'Trusted', 
          'Office' 
         ] 

讓我知道,如果任何人有同樣的問題,無法解決。 :)