PDA

View Full Version : combobox width



apocalipsyz
9 Apr 2014, 6:12 AM
Hi, I want to change combobox width when option is changed, but it doesnt work


var combo = new Ext.form.ComboBox({
margin: "5 0 0 0",
typeAhead: true,
triggerAction: 'all',
fieldCls: 'combobox-grid-large',
listConfig: {
width: 200
},
mode: 'local',
store: new Ext.data.ArrayStore({
id: 0,
fields: [
'funcId',
'displayText'
],
data: [[1, '1'], [2, '2'], [3, '3'], [4, '4']]
}),
listeners: {
change: function (field, newValue, oldValue) {
if (newValue > 2) {
var combobox = field.el;
combobox.fieldCls = 'combobox-grid-small';
}
}
},
valueField: 'funcId',
displayField: 'displayText'
});

'combobox-grid-small' = { width: 100px;}

Zinnia
9 Apr 2014, 6:21 AM
Use the below code, hope this may help you
listeners: {
change: function (field, newValue, oldValue) {
if (newValue > 2) {
field.setWidth(300);
// var combobox = field.el;
//combobox.fieldCls = 'combobox-grid-small';
}
}
},

apocalipsyz
10 Apr 2014, 4:16 AM
I`ve tried this, doesnt work

Zinnia
10 Apr 2014, 6:19 AM
Check the below code, it is working in my end.

apocalipsyz
15 Apr 2014, 3:35 AM
And what about comboboxes in the grid cell?