PDA

View Full Version : Extjs Combobox remote query double loading



Sundayextjs
1 Nov 2014, 7:38 AM
I have a problem with my combobox. Combobox load when i open my form panel and he get a query send by database. But when i click a trigger icon, he do the same query. I would to disable the query when i click a trigger icon.

My combobox code:


xtype: 'combobox',
fieldLabel: 'Operation',
id: 'combotypeoperation',
store: 'TypeOperations',
queryMode: 'remote',
displayField: 'libelle',
editable: false,
valueField: 'idTypeOperation',
listConfig: {
loadMask: false
},
listeners: {
render: function() {
this.store.load();
}
}


TypeOperations store code:


Ext.define(
'SecureDT.store.TypeOperations',
{
extend: 'Ext.data.Store',
requires: [
'SecureDT.model.TypeOperation'
],
model: 'SecureDT.model.TypeOperation',

proxy: {
type: 'ajax',
timeout: 120000,
url: 'secureDT/typeOperation/findAll.json',
reader: {
type: 'json',
root: 'data'
}
},
listeners: {
load: function() {
var combo = Ext.getCmp('combotypeoperation');
var recordSelected = combo.getStore().getAt(0).get('idTypeOperation');
combo.setValue(recordSelected);
}
}
}
);

scottmartin
1 Nov 2014, 1:10 PM
You can remove the query as follows:



listeners: {
beforequery: function(qe){
delete qe.combo.lastQuery;
}
}

Sundayextjs
3 Nov 2014, 3:12 AM
thank scottmartin for you reply. I put you code in my combobox view but he do the double request.
I would loading all combobox values in database when user click to open the form before he chose the informations by trigger clicking.



{
xtype: 'combobox',
fieldLabel: 'Operation',
id: 'combotypeoperation',
store: 'TypeOperations',
queryMode: 'remote',
displayField: 'libelle',
editable: false,
valueField: 'idTypeOperation',
enableKeyEvents: true,
listConfig: {
loadMask: false
},
listeners: {
beforequery: function(qe){
delete qe.combo.lastQuery;
},
render: function() {
this.store.load();
}
}
}

carol.ext
4 Nov 2014, 9:19 AM
Have you tried queryMode: 'local' ?


In queryMode: 'remote', the ComboBox loads its Store dynamically based upon user interaction.

Sundayextjs
5 Nov 2014, 12:41 PM
lIt work now. Thk carol.ext. I think that when i get informations form database queryMode is 'remote'. Thk