Something similar - I have a simple store holding data for a combo box. I want the user to be able to type in a new entry if it doesn't exist in the store and then when they leave the box - save that into the store and reload it. I've turned editable:true on the combo box but it doesn't make a difference, the change event doesn't seem to happen.
Here's the code:
Code:
var statusData = [
['Open', 'open'],
['Hold', 'hold']
];
var rStatusRecord = Ext.data.Record.create([
{name: 'code', type: 'string'},
{name: 'Status', type: 'string'}
]);
dsStatus = new Ext.data.SimpleStore({fields:['code','Status'], data:statusData});
cboStatus = new Ext.form.ComboBox({fieldLabel:"Status",id:"StatusID",tabIndex:11,
hiddenName:"Status",displayField:"Status",valueField:"code",
store:dsStatus,width:268,readOnly:false,selectOnFocus:true,typeAhead:true,mode:"local",
forceSelection: true,triggerAction: "all",emptyText:"Please Select...", editable:true});
cboStatus.addListener("change", cboStatus_OnChange);
function cboStatus_OnChange(cbo, newVal, oldVal)
{
Ext.MessageBox.alert("Status", "You Typed: " + newVal);
var statusRecord = new rStatusRecord({
code: "",
Status : ""
});
statusRecord.data.code = newVal;
statusRecord.data.Receipt_Party = newVal;
dsStatus.add(statusRecord);
cboStatus.reload();
}
Nothing seems to happen when I type text in. Any suggestions - something obvious that I'm missing???