PDA

View Full Version : selecting first value as default value or selected value for xtype:combo



greg_prop
20 Oct 2012, 3:05 AM
hi!
i am using the code below to fetch data using JsonStore, although data is being fetched from database in to drop-down but how can i select first value as selected value. I am using drop-down in toolbar not in form and data is being fetched from database not a static one.

var prices = new Ext.data.JsonStore({
autoDestroy: true,
url: 'transport.php?controller=templates&action=getPrice&propid=' + recId,
root: 'prices',
id: 'propprice',
fields: ['propertyID','price'],
autoload: true
});

and following for drop-down in toolbar.

{
xtype: 'combo',
fieldLabel: 'Property price',
id: 'prop_price',
//emptyText: 'Prices available',
triggerAction: 'all',
store: prices,
valueField: 'price',
displayField: 'price',
width:120
}

39501.


can anybody help?

sword-it
20 Oct 2012, 4:19 AM
Hi greg_prop
Please have a look at the link given below
http://stackoverflow.com/questions/3489189/load-default-value-for-a-combobox-extjs