I'm completely new to php coding, with a basic knowledge of html.
Nonetheless, I was given simple
tasks of improving a form page of our website company. It is written in php, as you may realized.
One of these tasks consists of adding a 'search-as-you-type' function to a text input combobox containing a list of suppliers. From my code analysis, I believe the trick should be implemented in this code snippet:
var storeSupplier = new Ext.data.JsonStore({
url: 'php/selectSupplier.php',
root: 'results',
fields: ['idSupplier', 'nameSupplier']
});
selectSupplier = new Ext.form.ComboBox({
width: 250,
xtype: 'combo',
mode: 'remote',
triggerAction: 'all',
editable: false,
fieldLabel: 'Supplier',
name: 'nameSupplier',
displayField: 'nameSupplier',
valueField: 'idSupplier',
hiddenName: 'idSupplier',
store: storeSupplier
});
I've looked into some php documentation and other solutions, but I couldn't understand nor adapt it to my situation. The closest I got was this Q&A, which seems like my coding but they are not talking about searching and matching values; this example which shows what I am trying to achieve (just the "Starting With" option would be perfect) and this documentation, which gives me some interesting methods like FindRecordByValue(value), but I have no idea how to use it properly.
Any help would be appreciated. Cheers,
--UPDATE--:
I noticed that some other fields of my form have already have this sort of filter function. The reason why I can't just do the same for the above situation is because of the mode:
remotestatus. The ones that are working are stated as
mode: local
.
When I tried the following approach, I got no values showing up at all:
listeners: {
'keyup': function() {
this.store.filter('nameSupplier', this.getRawValue(), true, false);
},
'beforequery': function(queryEvent) {
queryEvent.combo.onLoad();
queryEvent.combo.expand();
// prevent doQuery from firing and clearing out my filter.
return false;
}
}