PDA

View Full Version : Initial value of combo box



hiral
17 Jul 2008, 10:05 PM
Hi all,

I have two combo boxes on my form. When I select the second should be filter based on the selection. So at initial level the second combo should have value something like "select.." and not anything else.

Here is my code



{
x: 2,
y: 10,
xtype: 'label',
text: 'Device Category:'
},{
x:125,
y:7,
xtype:'combo',
store: this.devicecategorycombo,
displayField:'devicecategory_name',
valueField:'devicecategory_id',
name:'devicecategory_id',
typeAhead: true,
mode: 'remote',
emptyText: 'Select Device Category',
triggerAction: 'all',
editable:false,
selectOnFocus:true,
anchor: '26%',
allowBlank:false,
id:'devicecategory_id',
listeners:{select:{fn:function(combo, value){
var comboType = Ext.getCmp('devicetype_id');
comboType.clearValue();
comboType.setValue('Select Device Type');
comboType.store.filter('devicecategory_id', combo.getValue());
comboType.enable();
}}}

},{
x: 2,
y: 38,
xtype: 'label',
text: 'Device Type:'
},{
x:125,
y:35,
xtype:'combo',
store: this.devicetypecombo,
displayField:'devicetype_name',
valueField:'devicetype_id',
name:'devicetype_id',
typeAhead: true,
mode: 'remote',
emptyText: 'Select Device Type',
triggerAction: 'all',
editable:false,
selectOnFocus:true,
anchor: '26%',
allowBlank:false,
id:'devicetype_id',
disabled:true,
lastQuery:'',
listeners:{select:{fn:function(combo, value){
var comboModel = Ext.getCmp('devicemodel_id');
comboType.clearValue();
comboType.setValue('Select Device Model');
comboModel.store.filter('devicemodel_id', combo.getValue());
comboModel.enable();
}}}
}


Please help

Thanks
Hiral Thaker

hiral
18 Jul 2008, 10:42 PM
Hi, All

I have one combo on my form. Which will be fill up from remote call. But initially I want to load this combo blank. Because it should be fill up based on first combo selection. So If I am not giving 'store' to this.devicemodelcombo it gives me this.store not defined.




// For device model
this.LookupRecordModel = Ext.data.Record.create([
{name: 'devicemodel_id'},
{name:'devicetype_id'},
{name: 'devicemodel_name'}
]);
//Store for combo box of device model
this.devicemodelcombo = new Ext.data.Store({
proxy: new Ext.data.HttpProxy({url: this.url})
,baseParams:{mode:'getDeviceModel', objName:"devicemodel",sort:"devicemodel_name"}
,reader: new Ext.data.JsonReader({
id:'devicemodel_id',
root:'rows',
totalProperty:'totalCount'
},this.LookupRecordModel)
});

// My field from items
,{
x:125,
y:63,
xtype:'combo',
store: this.devicemodelcombo,
displayField:'devicemodel_name',
valueField:'devicemodel_id',
name:'devicemodel_id',
typeAhead: true,
mode: 'remote',
emptyText: 'Select Device Model',
triggerAction: 'all',
editable:false,
selectOnFocus:true,
anchor: '26%',
disabled:true,
//allowBlank:false,
id:'devicemodel_id'
}
Thanks

evant
18 Jul 2008, 10:56 PM
If you don't get an answer, please bump your initial thread, don't post a new one with the same thing.