PDA

View Full Version : ComboBox Strange behavior



jonetto
11 Dec 2011, 7:37 AM
Hi. we have been dealing with this issue now for almost 6 months.

We have this combobox (part of a container of a form):


items:[
{
xtype:'combo',
fieldLabel:'Tipo Factura',
width:50,
id:'tipofactura',
displayField:'Descripcion',
valueField:'idElemento',
forceSelection:true,
editable:false,
triggerAction:'all',
typeAhead:true,
minChars:1,
hiddenName:'idTipoFactura',
loadingText:'Cargando....',
lazyInit:false,
store:new Ext.data.JsonStore({
url:'listDecodificadora.php',
autoLoad:true,
baseParams:{ idEmpresa:idEmpresaUsuario, idTabla:10, tipo:'FAC'},
fields:[ 'Descripcion', 'idElemento']
})
}
]

We want to display "Descripcion" value. However, the issues comes in because sometimes it works and some others no. It sometimes displays the correct value from "Descripcion" and others "idElemento", combobox valuefield. We tried in different environments because we thought it was a connection problem or sync one. But not. The behavior is very strange.

Does someone know why this can happen? 70% we get Descripcion 30% idElemento. We have other comboboxes and happens the same.

skirtle
12 Dec 2011, 6:53 AM
You have several incompatible config options. This may go some way to explaining the issue.

You have editable: false. Given that, you should get rid of minChars, forceSelection and typeAhead. I would also add mode: 'local'.

You should also be careful with the static id: 'tipofactura'. Ids must be unique, otherwise you will see all kinds of strange behaviour. It is highly recommended that you don't specify ids on your components.