PDA

View Full Version : Help Combobox



Ciole7
16 May 2010, 11:22 PM
This is my code :

ArticoloStore = Ext.extend(Ext.data.JsonStore, {
constructor : function(cfg) {
cfg = cfg || {};
ArticoloStore.superclass.constructor.call(this, Ext.apply( {
storeId : 'ArticoloStoreId',
fields : [ {
name : 'id'
}, {
name : 'descrizione'
} ]
}, cfg));
}

});

//
####################################################################################
//
####################################################################################
//
####################################################################################

UltpreFormUi = Ext.extend(Ext.form.FormPanel, {
title: 'Filtri di ricerca',
labelWidth: 100,
labelAlign: 'left',
layout: 'form',
id : 'Ultpre.UltpreFormId',
//width: 753,
height: 140,
padding: 10,
//anchor: '-10',
collapsible: true,
initComponent: function() {

//----------------------------------------------------------------------------

var articoloStore = new ArticoloStore();

articoloStore.proxy = new Ext.ux.data.DwrProxy({
apiActionToHandlerMap : {
read : {
dwrFunction : AnagraficheManager.getArticoliAutocomplete,
getDwrArgsFunction : function(trans) {
var theForm = Ext.getCmp('Ultpre.UltpreFormId').getForm();
var desArticoloId = theForm.findField('desArticoloId').getValue();
return [desArticoloId];
}
}
}
});

articoloStore.addListener('exception', function() {
Ext.MessageBox.alert('errore', 'errore articoloStore');
});
articoloStore.proxy.addListener('exception', function() {
Ext.MessageBox.alert('errore', 'errore articoloStore.proxy');
});

//----------------------------------------------------------------------------

this.items = [
{
xtype : 'textfield',
fieldLabel : 'Codice articolo',
name : 'codArticolo',
anchor : '50%'
},
{
xtype : 'combo',
fieldLabel : '',
id : 'desArticoloId',
name : 'desArticolo',
anchor : '50%',
editable : 'true',
minChars : '3',
//typeAhead: true,
triggerAction: 'all',
mode : 'remote',
store : articoloStore,
valueField : 'id',
displayField : 'descrizione',
hiddenName : 'descrizione'
}
];
UltpreFormUi.superclass.initComponent.call(this);
}

});


My problem is that the filter works only when I leave the focus
combobox and then we return from above.
Example: I write on the combobox 'CHICKEN' and instead show all
results;
I position it to another field and i go back on the combobox and
write 'PIG', it filters on 'CHICKEN', or what I had written before;
I position it on another field and turning back on the combobox,
and write 'HORSES', it filter through 'PIG' and so on ...
WHY?