PDA

View Full Version : Reusing some common cofigs



prasad508211
2 Jul 2010, 10:17 PM
Hi.

I am using 3 combo boxes in my project as follows:


xtype: 'combo',
width:150,
id:'IdRetId',
emptyText:'Select Origin',
value:'Select Retailer Id',
triggerAction: 'all',
editable:true,
typeAhead:true,
forceSelection:true,
mode:'remote',
store:retDetStore,
displayField: 'RETAILER_NAME',
valueField: 'RETAILER_ID'

Those are having few common configs. Is their any mechanism in which I can reduce the common configs?
Please help. Thanks in advance

Animal
2 Jul 2010, 10:30 PM
There's been quite a bit of work put into not mutating passed in config objects.

You should just be able to reuse that object.

Condor
2 Jul 2010, 10:58 PM
Correct, but because your combobox is mode:'remote', each combobox will do it's own request to get the items in the list.

It's probably better to configure the retDetStore with autoLoad:true and the comboboxes with mode:'local'.

ps. The only reason your comboboxes can share the same store is because you've configured them with triggerAction:'all'.