PDA

View Full Version : Combo box autosize



simon
12 Jul 2012, 11:24 PM
I have combo box on grid tbar:


tbar: ['Select channel:',
{ xtype: 'combo',
store: storeDC,
id: 'dcId',
autoWidth: true,
allowBlank: false,
editable: false,
valueField: 'dcId',
displayField: 'dcName',
typeAhead: true,
mode: 'local',
triggerAction: 'all',
forceSelection: true,
selectOnFocus: true,
listeners: {
'afterrender': function (combo) {
combo.list.setSize('auto', 0);
combo.innerList.setSize('auto', 0);
}
}
}
]

I would like to resize it on afterrender.

but I get an error:
"Uncaught TypeError: Cannot call method 'setSize' of undefined "

so, combo.list is undefined.

What should I change?

sword-it
13 Jul 2012, 12:26 AM
but I get an error:
"Uncaught TypeError: Cannot call method 'setSize' of undefined "

so, combo.list is undefined.


Hi!

i guess your problem is with ExtJs3.x or 4.x not with Sencha touch
(moving thread to 4.x)


by the way, you are right, combo.list is undefined.

combo.list is always show on trigger click (trigger icon).As you may not find combo.list before clicking it.

list will be always initialized after trigger clickbut not on afterrender of combo.

so try to use initList for combo (EXTJS 3.x)

you may try to use expand event or try to check source code for combo (see onTriggerClick()) (4.x)