Ext論壇上的解決方案很少,但是我無法獲得其中的任何解決方案。看來我錯過了一些小事。調整Ext.form.ComboBox的大小以適應其內容
我需要調整組合框的大小,以適應其首次創建時的內容。當內容發生變化時,我無需擔心它的大小。
是否有任何使用Extjs 3.2的工作示例?
目前代碼:
var store = new Ext.data.ArrayStore({
fields: ['view', 'value', 'defaultselect'],
data: Ext.configdata.dataCP
});
comboCPU = new Ext.form.ComboBox({
tpl: '<tpl for="."><div class="x-combo-list-item"><b>{view}</b><br /></div></tpl>',
store: store,
displayField: 'view',
width: 600,
typeAhead: true,
forceSelection: true,
mode: 'local',
triggerAction: 'all',
editable: false,
emptyText: 'empty text',
selectOnFocus: true,
listeners: { select: AdjustPrice, change: AdjustPrice, beforeselect: function (combo, record, index) { return ('false' == record.data.disabled); } },
applyTo: 'confelement'
});
我也試着刪除寬度:600與minListWidth替換它:600,但這個結果之後,並沒有解決問題。 alt text http://img28.imageshack.us/img28/7665/4272010105134am.png
有根據文檔沒有這樣的配置選項。 http://www.extjs.com/deploy/ext/docs/output/Ext.form.ComboBox.html#configs – ITRushn 2010-04-27 21:42:48