PDA

View Full Version : Combobox List Width



innosia
1 Dec 2011, 12:35 AM
I look for the API of comboxbox (which is pretty useless), it mentions if I want to set the combobox list (lower part) width, use listWidth, but I try it and it doesn't work.

var txtPrice = Ext.create('Ext.form.field.ComboBox', {
id: 'txtPrice',
name: 'txtPrice',
xtype: 'combo',
valueField:'PriceList',
displayField:'PriceList',
hidden: false,
mode: 'local',
queryMode: 'local',
triggerAction: 'all',
emptyText: '(Input Price Here)',
resizable: false,
forceSelection:false,
store: store7,
autoLoad: false,
minChars: 1,
matchFieldWidth: false,
minListWidth: 320,
listWidth: 320,
autoSelect: true,
enableKeyEvents: true,
loadingText: "wait...",
selectOnFocus: true,
width:100,
listeners: {
loadexception: {
fn: function (proxy, store, response, e) {
Ext.MessageBox.alert(alert_lbl, "Fail Loading Price");
}, scope: this
},
select: function (combo, record, index) {
// var val = record[0].get("PriceList");
// val = trim(val);
// this.setRawValue(val);
},
blur : function() {
var val = this.getRawValue();
val = trim(val);
this.setRawValue(val);
}/*,
expand: function (combo) {
//var compcode = Ext.getCmp('selectedSymbol').getValue();
var compcode = formPanel.down('[name=txtSelectedSymbol]').getValue();
//store7.load({ params: { cocode : compcode } });
}*/
}
});


How to make the list width 320px?

twaindev
1 Dec 2011, 2:41 AM
listConfig: {
minWidth: 320
},

tobiu
1 Dec 2011, 5:56 AM
well, you should not flame the api docs if you do not use them correctly.
listWidth was an Ext JS 3 config, in 4 you have the object:
http://docs.sencha.com/ext-js/4-0/#!/api/Ext.form.field.ComboBox-cfg-listConfig

so you can set width to 370 or to 'auto' if you prefer it this way.

please use code tags in the future to format your code!