PDA

View Full Version : combobox / forceselection:false / listener?



flohoff
10 Apr 2009, 2:53 AM
Hi,
i am trying to build a quick tag adding box where i used a combobox with an remote JSON store to load available tags. I have a 'select' listener which works as expected and resolves to the selected existing tag. Now - which event do i listen to to get elements not in the store yet? I tried 'change' but it does not really work - it fires if i press tab but not on return, and it seems the new value is not set or sometimes set to an element in the store/list.



xtype: 'combo',
store: tagstore,
fieldLabel: "Add tag",
displayField:'tag',
typeAhead: true,
mode: 'local',
forceSelection: false,
triggerAction: 'all',
emptyText: 'Select a tag',
selectOnFocus: true,
hideTrigger:true,
listeners: {
'change': function(combo, oldval, newval) {
console.log("change fired");
var view=Ext.getCmp('tagview');
view.setValue(view.getValue()+newval);
this.setValue(null);
},
'select': function(combo, record, idx) {
var tag=record.get('tag');
var view=Ext.getCmp('tagview');

console.log("onSelect fired");

view.setValue(view.getValue()+tag);

this.setValue(null);
}
}