I am using the jQuery-autocomplete plugin to get suggestions for completion of the input string using an AJAX call to a server. Also, the server takes care of returning the results in the order I would want them to appear but autocomplete shows them in a different order.
How can I configure jQuery autocomplete to not reorder the output ? I don’t require any kind of processing on the client’s end as the data has already been ranked/sorted as required.
Well, it turned out to be simpler than I thought. I decided to read the code of the plugin and modify it by commenting out the code that sorts my output.
That is when I found a variable ‘sortResults:true’ in defaults. So, all I needed was to set that variable to false. I didn’t find this in the documentation though.
$('#search').autocomplete ( { url: "index.php", sortResults: false } )Now the output is in the exact order that I require.
I got the idea of reading the code to find/solve the problem from here : jQuery "Autocomplete" plugin is messing up the order of my data
(That isn’t the same plugin)
Thanks. 🙂