Does anyone know of a way to make the Spry AutoSuggest Widget show all options when you first click on it?
var SpryAutoSuggest3 = new Spry.Widget.AutoSuggest('statusform', 'suggestedStatus', 'dsStatus', 'statusType', {loadFromServer: true, urlParam: 'status'});
This grabs the data from the XML file as you type it. The XML is database generated on the fly. The XML either shows all the options, or just the ones beginning with the string passed to it from the form field.
I just want to show all the options when the field is first clicked, and allow them to type if they want to filter it down. My only other option is a normal select list, but thats not as fun ![]()
Cheers,
Steve
Hi Arnout,
I am a little late coming back to this... I have tried several methods but have not come up with a solution.
var SpryAutoSuggest = new Spry.Widget.AutoSuggest('faultSuggest', 'suggestedFaultCodes', 'dsFaultCodes', 'code', {loadFromServer: true, urlParam: 'code'});
function showList(event){
dsFaultCodes.removeAllFilters(true);
SpryAutoSuggest.showSuggestions(true);
}
function listener(){
Spry.$$("#previousEngineFault").addEventListener("click", showList, false);
}
Spry.Utils.addLoadListener(listener);
All this does is show an empty autosuggest. I can't make it requery the dataset. Any ideas?
Cheers,
Steve
As usual I answer my own question just moments after posting it!
function showList(event){
dsFaultCodes.removeAllFilters(true);
dsFaultCodes.loadData();
SpryAutoSuggest.showSuggestions(true);
}
This does work, but only once, if you clear the field and try to start again it wont list them all, just the last one you selected. For some reason the removeAllFilters isn't working.
Any ideas?
Cheers,
Steve
You can manually try to trigger the `onPostLoad` event: dsFaultCodes.notifyObservers('onPostLoad')
As usual I answer my own question just moments after posting it!
function showList(event){
dsFaultCodes.removeAllFilters(true);
dsFaultCodes.loadData();
SpryAutoSuggest.showSuggestions(true);
}
This does work, but only once, if you clear the field and try to start again it wont list them all, just the last one you selected. For some reason the removeAllFilters isn't working.
Any ideas?
Cheers,
Steve
>
North America
Europe, Middle East and Africa
Asia Pacific