PDA

View Full Version : Selection on ComboBox doesnt select an item



digitalkaoz
2 Sep 2008, 5:22 AM
he guys,

i got a weird problem here...

i have a combox (working, solved the eval problem after reading this forum ;) ), and a store for the data.

the combobox renders fine, and the store-items are showing up if i pull the trigger...
but a selection of an item wont select it, the combobox collapses and nothing is selected...

here my code (i am filling the store on the fly so its initially empty)


getCombo : function(_id,_name,_vtype,_emptyText,_label){
Dcp.tpl.combos[_id] = {
xtype:'combo',
typeAhead: true,
mode: 'local',
forceSelection: true,
triggerAction: 'all',
selectOnFocus:true,
valueField:'name',
allowBlank:false,
fieldLabel: _label,
name: _name,
emptyText: _emptyText,
anchor: '100%',
tpl:new Ext.XTemplate(
'<tpl for="."><div class="x-combo-list-item">{name}({description})</div></tpl>'
),
store:new Ext.data.JsonStore({
fields :[
{name :'id'},
{name :'name'},
{name :'description'},
{name :'contact_id'},
],
data:[],
})
};
return Dcp.tpl.combos[_id];
}


maybe it has todo with my Xtemplate??

please help, if you know the answer :)

RobSmith
5 Sep 2008, 5:09 AM
Try to set the displayField property.

digitalkaoz
7 Sep 2008, 11:50 PM
omg im so stupid...it works...thanks :)

Tonio
13 Oct 2008, 1:27 AM
Got the same problem but I can't have a valid ValueField: here's my tpl :


tpl: '<tpl for="."><div class="x-combo-list-item">'+
'<tpl for="properties">{nom_dept}</tpl>'+
'</div></tpl>',
but the only valid information that I want to be displayed is properties.nom_dept.
How can I get that working ?

Thanks.

digitalkaoz
3 Nov 2008, 1:57 AM
try this, it worked for me

tpl:new Ext.XTemplate(
'<tpl for="."><div class="x-combo-list-item">{name}({description})</div></tpl>'
),