I'm using Jörn Zaefferers autocomplete plugin for jQuery to enable a live search field, which is working great. The user input gets sent to a search service, that returns formatted results in Json format. When a result gets chosen, the values are entered into a separate table.
What I'm having trouble with is: After a user selects a search result from the drop-down, I don't want the search (parameters entered by the user) to be overwritten by the result. Which is the default behaviour.
I'm looking for an option that I can use to disable this, If it doen't exist though, I may have to look for a workaround / different plugin.
Here is my current usage of the autocomplete plugin with options:
$('#searchInput').autocomplete('searchUrl',
{
dataType: 'json',
parse: function(data) {
//logic to parse search results that are returned from search
return datarows;
},
formatItem: function(row, i, max) {
return row.Description;
},
width: 500,
highlight: false,
multiple: false,
minChars: 2,
delay: 800,
selectFirst: false,
autoFill: false,
cacheLength: 10
})
.result(function(event, item) {
//logic to handle item chosen by the user
});