dev_java
24 Aug 2011, 4:26 AM
Hi,
In my layout, i have a combo box which will be loaded on click of some button. I am using setValue() method to set first value of the store to combo box. It works fine, but 'autoLoad:true' is not working.
After setting the value, when i try to select the drop down arrow of the combo , the store is loading again. This happens only for the first time.
27671
Can any one tell how to restrict the combo load on select of drop down arrow?
Please find my piece of code
//Store Model
Ext.define('grpStoreModel',{
extend: 'Ext.data.Model',
fields: [
'group',
'groupValue'
]
});
//Store
function getGroupStore()
{
return Ext.create('Ext.data.Store', {
id:'grpStore',
model: 'grpStoreModel',
autoLoad:false,
proxy: {
type: 'ajax',
url:'../datas/getGroupDetails.htm',
extraParams:{grpn:grpVal},
reader: {
type : 'json',
totalProperty:'grpListSize',
root:'grpList',
successProperty: 'success'
}
},
listeners:
{
'load':{
fn: function(store, records, options) {
if(store.getCount()>0){
Ext.getCmp('group_Combo').setValue(store.getAt(0).data.group);
}
}
}
}
});
}
// Group Combo code
{
xtype: 'combo',
id : 'group_Combo',
width:225,
fieldLabel:'Group',
store: getGroupStore(),
valueField : 'group',
displayField : 'groupValue',
listeners:{
select : function( combo, record, index ) {
}
}
}
// Store load is done on button click
Ext.getCmp('group_Combo').getStore().load({
params:{
grpn:grpVal
}
});
Thanks in advance
dev_java
In my layout, i have a combo box which will be loaded on click of some button. I am using setValue() method to set first value of the store to combo box. It works fine, but 'autoLoad:true' is not working.
After setting the value, when i try to select the drop down arrow of the combo , the store is loading again. This happens only for the first time.
27671
Can any one tell how to restrict the combo load on select of drop down arrow?
Please find my piece of code
//Store Model
Ext.define('grpStoreModel',{
extend: 'Ext.data.Model',
fields: [
'group',
'groupValue'
]
});
//Store
function getGroupStore()
{
return Ext.create('Ext.data.Store', {
id:'grpStore',
model: 'grpStoreModel',
autoLoad:false,
proxy: {
type: 'ajax',
url:'../datas/getGroupDetails.htm',
extraParams:{grpn:grpVal},
reader: {
type : 'json',
totalProperty:'grpListSize',
root:'grpList',
successProperty: 'success'
}
},
listeners:
{
'load':{
fn: function(store, records, options) {
if(store.getCount()>0){
Ext.getCmp('group_Combo').setValue(store.getAt(0).data.group);
}
}
}
}
});
}
// Group Combo code
{
xtype: 'combo',
id : 'group_Combo',
width:225,
fieldLabel:'Group',
store: getGroupStore(),
valueField : 'group',
displayField : 'groupValue',
listeners:{
select : function( combo, record, index ) {
}
}
}
// Store load is done on button click
Ext.getCmp('group_Combo').getStore().load({
params:{
grpn:grpVal
}
});
Thanks in advance
dev_java