Code:
var paisStore = Ext.create('Ext.data.Store', {
fields: ['iIdPais', 'vcNombrePais'],
proxy: {
type: 'ajax',
url: '/TEST/Generales/GetCountries'
},
autoLoad: true, //When the double click is randomly required, none of the following listeners gets fired
listeners: {
load: function(store) {
if (store.data.items.length == 1) {
cboPais.select(store.data.items[0]);
}
cboPais.unmask();
}
}
}); //Sometimes I need to click twice on an option of this combo to select an option
var cboPais = new Ext.form.ComboBox({
id: 'cboPais',
name: 'cboPais',
displayField: 'vcNombrePais',
valueField: 'iIdPais',
queryMode: 'local',
emptyText: cboRepEstadisticoPais_Empty,
fieldLabel: cboRepEstadisticoPais_Text,
labelWidth: 50,
width: 300,
margin: '5 5 5 5',
store: paisStore,
lastQuery: '',
allowBlank: false,
editable: false,
typeAhead: false,
forceSelection: true,
listeners: {
select: function(combo, records, eOpts) {
regionStore.load();
cboRegion.mask();
},
render: function() {
cboPais.mask();
}
}
}); //So this store doesn't get loaded when that happens
var regionStore = Ext.create('Ext.data.Store', {
fields: ['iIdRegion', 'vcNombreRegion'],
proxy: {
type: 'ajax',
url: '/TEST/Generales/getRegions'
},
listeners: {
load: function(store, records) {
store.insert(0, [{
'iIdRegion': 0,
'vcNombreRegion': txtTodos
}]);
cboRegion.select(0);
cboRegion.unmask();
},
beforeload: function(store, operation, eOpts) {
operation.params = {
iIdPais: cboPais.getValue()
};
}
}
}); //No options are added to this combo's list
var cboRegion = new Ext.form.ComboBox({
id: 'cboRegion',
name: 'cboRegion',
displayField: 'vcNombreRegion',
valueField: 'iIdRegion',
queryMode: 'local',
emptyText: cboRepEstadisticoRegion_Empty,
fieldLabel: cboRepEstadisticoRegion_Text,
labelWidth: 50,
width: 300,
margin: '5 5 5 5',
store: this.regionStore,
lastQuery: '',
allowBlank: false,
editable: false,
typeAhead: false,
forceSelection: true,
value: 1,
listeners: {
render: function() {
cboRegion.mask();
}
}
});
[4.1.0] - Random two click needed to select an option on a combo
Aucun commentaire:
Enregistrer un commentaire