dende1979
14 Sep 2007, 4:59 AM
Hello,
I have an autocompleting combo which load/reload Its datastore calling a remote service.
This works fine but datastore is reloaded only after typing something into the combo and pressing the key-down or the downarrow on the right (in other words only after 'expand' event is fired).
I want to load/reload data store (and to show it by expanding the combo) after typing any character into the combo, too:
1. select the combo
2. type a character
3. reload combo's datastore
4. expand combo and show updated datastore
...
In other words how can I assign the 'keypressed' event to the combobox?
Thanks a lot.
Here my javascript code for my combo
Ext.onReady(function(){
var doctorStore = new Ext.data.Store (
{
proxy: new Ext.data.HttpProxy (
{
url: "searchdoctorflex.do?"
}
),
reader: new Ext.data.JsonReader (
{
root: "doctors",
id: "doctor_id",
totalProperty: "totaldoctors"
}, [
{name: "doctor_id"},
{name: "doctor_name"}
]
)
}
);
doctorStore.load({params:{'name':'','namelike':true}});
var doctorList = new Ext.form.ComboBox ({
typeAhead: true,
emptyText: "Scegli...",
displayField: "doctor_name",
valueField: "doctor_id",
name: "doctor",
hiddenName: "doctorId",
mode: 'local',
store: doctorStore,
selectOnFocus:true,
forceSelection:true,
allTimeStoreLoad:true
});
Ext.form.ComboBox.prototype.onTriggerClick = function(){
if(this.disabled){
return;
}
if(this.isExpanded()){
this.collapse();
this.el.focus();
}else {
this.hasFocus = true;
if(this.triggerAction == 'all') {
this.doQuery(this.allQuery, true);
} else {
this.doQuery(this.getRawValue());
}
this.el.focus();
}
if(this.allTimeStoreLoad)
this.store.reload({params:{'name':this.getRawValue(),'namelike':true}});
}
doctorList.applyTo('doctorCombo');
});
I have an autocompleting combo which load/reload Its datastore calling a remote service.
This works fine but datastore is reloaded only after typing something into the combo and pressing the key-down or the downarrow on the right (in other words only after 'expand' event is fired).
I want to load/reload data store (and to show it by expanding the combo) after typing any character into the combo, too:
1. select the combo
2. type a character
3. reload combo's datastore
4. expand combo and show updated datastore
...
In other words how can I assign the 'keypressed' event to the combobox?
Thanks a lot.
Here my javascript code for my combo
Ext.onReady(function(){
var doctorStore = new Ext.data.Store (
{
proxy: new Ext.data.HttpProxy (
{
url: "searchdoctorflex.do?"
}
),
reader: new Ext.data.JsonReader (
{
root: "doctors",
id: "doctor_id",
totalProperty: "totaldoctors"
}, [
{name: "doctor_id"},
{name: "doctor_name"}
]
)
}
);
doctorStore.load({params:{'name':'','namelike':true}});
var doctorList = new Ext.form.ComboBox ({
typeAhead: true,
emptyText: "Scegli...",
displayField: "doctor_name",
valueField: "doctor_id",
name: "doctor",
hiddenName: "doctorId",
mode: 'local',
store: doctorStore,
selectOnFocus:true,
forceSelection:true,
allTimeStoreLoad:true
});
Ext.form.ComboBox.prototype.onTriggerClick = function(){
if(this.disabled){
return;
}
if(this.isExpanded()){
this.collapse();
this.el.focus();
}else {
this.hasFocus = true;
if(this.triggerAction == 'all') {
this.doQuery(this.allQuery, true);
} else {
this.doQuery(this.getRawValue());
}
this.el.focus();
}
if(this.allTimeStoreLoad)
this.store.reload({params:{'name':this.getRawValue(),'namelike':true}});
}
doctorList.applyTo('doctorCombo');
});