Autocomplete listing all results unfiltered (wrongly)
I am using the autofilter plugin which works fine - I have also used the .result() method to pass the id of the selected resutl through!
The problem I am having is that the first search that is carried out (after the 3rd letter is entered when minChars:3, or the the 4th character if minChars:4) it seems to be returning all the results in the dataset (or atleast the first 20 becuase max:20 is set.)
This may be because I have a large dataset (well over 16,000 records)
Code:
$(document).ready(function(){
$("#t").autocomplete("http://www.newhomesforsale.co.uk/autocomplete_std2.php",{
minChars: 3,
width: 453,
autoFill: false,
matchContains: false,
max: 20,
delay:500,
cacheLength:1
}).result(function (evt, data, formatted) {
$("#tid").val(data[1]);
$("#searchtype").val(data[2]);
});
});
<form autocomplete="off">
<h1>Version 2</h1>
<p>Enter search phrase:<input name="t" id="t" type="text" /></p>
<p>id:<input name="tid" id="tid" type="text" />
id type:<input name="searchtype" id="searchtype" type="text" />
</p>
</form>
This is suggesting towns in the UK - there are many starting bri (entering characters towards bristol) - rather than listing them, when I type "bri" I get the first 20 in the list.
Please see http://www.newhomesforsale.co.uk/test.php to test for yourself!
Can anyone tell me why this happens so I can try and fix it.
Thanks