PDA

View Full Version : Problem between combobox and store



cellarosi
23 Apr 2012, 4:24 AM
Hi,
sorry if I'm not on right section and for the english.. ;)

I have a problem with store and dynamic combobox.
My situation is particular so I'll try to explane only one simple example that should reproduce the problem...

I have a combobox with store linked to it. Near that I build a button needed to reload
a store with random different data . All these component are created together at the start of the page.
So you have a select box and the button reload a store that need to populate that combo.

At the first time I click a button, the store is loaded without any problems and the combo is
populated. But if i close the combo and I click again on the button, when I try to reopen the combo,
the "Login.." appear and nothing change..
It doesn't try to make any call (i checked with firebug).
It' only put the wait message. In this situation (mean with open combo), if i try to realod the data, all will be right.

The data have been loaded correctly because i see them, but the loading messages avoid me to click them.
It seems that the combo doesn't know that it has only to display the message without search anything..

Any ideas?

scottmartin
23 Apr 2012, 7:53 AM
If you close the combo and update the store, the combo has no knowledge of the change.
You will need to tell the combo to load the store again.

Regards,
Scott.

cellarosi
23 Apr 2012, 8:03 AM
Yes, exactly, but i don't know how do it...
Have you an idea???

scottmartin
23 Apr 2012, 8:38 AM
Have a look at combo.lastQuery

Scott.

cellarosi
3 May 2012, 12:15 AM
I read docs about that and I found the best way to do it should be declaring a beforequery listeners with
delete queryEvent.combo.lastQuery inside it.

I have tried with queryEvent.combo.lastQuery = null; and with delete queryEvent.combo.lastQuery;

But both doesn't work.

The loading still there

cellarosi
7 May 2012, 3:14 AM
No idea about that???

scottmartin
7 May 2012, 5:07 AM
Please provide some code... that should reset query.

Scott.

cellarosi
7 May 2012, 5:47 AM
Please provide some code... that should reset query.

Scott.

I did it from designer.. This is the column


xtype: 'gridcolumn',
renderer: function(value, metaData, record, rowIndex, colIndex, store, view) {
store = Ext.getStore('HourTypes');
index = store.findExact('id',value);
if (index != -1){
rs = store.getAt(index).data;
return rs.text;
}
return '';
},
id: 'HoursType',
dataIndex: 'hour_type_edit_id',
flex: 1,
text: 'Tipo di ora',
field: {
xtype: 'combobox',
id: 'hour_type',
fieldLabel: 'Label',
hideLabel: true,
forceSelection: true,
queryMode: 'local',
store: 'HourTypes',
valueField: 'id',
listeners: {
beforequery: {
fn: me.onHour_typeBeforeQuery,
scope: me
},
show: {
fn: me.onHour_typeShow,
scope: me
}
}
}


where onHour_typeBeforeQuery ?is:



onHour_typeBeforeQuery: function(queryEvent, options) {
queryEvent.combo.lastQuery = null;
}