The autocompleter in script.aculo.us expects that the server response is a <ul>
list. Is there some way for me to extend or replace this behaviour so it can take server response that is an XML or JSON document instead?
Is there also a way to extend the autocompleter's renderer so I can add a footer to the autocompletion list?
Yes you can extend the behaviour of script.aculo.us's autocompleter. You do this by overriding the
onComplete
method with code that handles the json data and creates the<ul>
-list for you. This list should then be sent toupdateChoices
.Say you will retrieve the following JSON response when you search for "U":
An example of an extension of Ajax.Autocompleter that can handle the response above:
There is also an example on how to replace autocompleter's width reset behaviour.