PDA

View Full Version : ExtJS Combobox select and store load problem



Shehul
28 Mar 2012, 10:45 AM
Hi,

I have a store with load listener,

var mystore = Ext.create('Ext.data.Store',
{
model : 'myList',
autoLoad : false,
storeId : 'MyStore',
listeners :
{
'load' : function (store, records, options) {
// I load another store here
}
}, scope : this
}


I also have a combobox which uses this store and has a select listener,

// var fleets = Ext.create('Ext.form.field.ComboBox',
var fleets = Ext.create('Ext.form.ComboBox',
{
store : 'MyStore',
displayField : 'Name',
valueField : 'Id',
typeAhead : true,
fieldStyle : 'cmbfonts',
labelCls : 'cmbLabel',
mode : 'local',
triggerAction : 'all',
fieldLabel : ' Names ',
emptyText : 'nothing to display',
tooltip : 'Select group of names to show',
selectOnFocus : true,
width : 300,
labelWidth : 40,
listeners :
{
'select' : function (combo, value) {
}
}



I load the mystore via mystore.load and than it inturn loads Combobox. Which is expected behaviour,

but than when I select default item in combo box for first time , I see my store loads again (I can see in firebug) as well as my store load events messages. This gives bad user experience,

Why is this happening while I already have the store loaded and combo has data.

Please reply if I am doing something wrong. Please reply how to fix the issue.

Thanks,
Shehul

mitchellsimoens
28 Mar 2012, 11:20 AM
rename mode to queryMode

Shehul
28 Mar 2012, 11:27 AM
Thank you mitchellsimoens (http://www.sencha.com/forum/member.php?22216-mitchellsimoens), you saved my lot time.

marri
18 Apr 2013, 8:29 AM
Hi mitchellsimoens (http://www.sencha.com/forum/member.php?22216-mitchellsimoens),

I am running into a combobox related issue any suggestion will be highly appreciated,

My problem is right now i am using linked combobox in my grid with static store for that combobox column alone data is coming from a static store and for other columns in grid data is coming from another store it is working fine now below is the code i am using for that,

LCombo.items = [
['item1', 'item1'],
['item2', 'item2'],
['items3', 'item3'],
['item4', 'item4'],

];

LCombo.description = [
[1, 'item1', 'item11'],
[2, 'item1', 'item12'],
[3, 'item1', 'item13'],
[4, 'item2', 'item21'],
[5, 'item2', 'item22'],

];

var itemstore = new Ext.data.SimpleStore
({
fields: ['columnId', 'columnName'],
data: LCombo.items
});

var descstore = new Ext.data.SimpleStore
({
fields: ['id', 'cid', 'linkedcolumnName'],
data: LCombo.description
});


Now i am using this static store(itemstore, descstore) in linked comboboxs, now i want to replace this static store with a store where the data is coming from database to that store.

I am almost all spent so munch time on this so please help out from this

Thanks in advance