Reputation: 3934
var CollectionForAutoComplete = new Array();
function AutoCompleteTextBox() {
var data = CollectionForAutoComplete;
//var ac = $("#setcommonelement_ElementName").autocomplete(data);
//ac.disable();
// ac.setOptions({ noCache: true });
$("#setcommonelement_ElementName").autocomplete(data, {
minChars: 0,
width: 262,
matchContains: "word",
scrollHeight: 220,
cacheLength: 0
});
}
function generateStringForAutoComplete(CommonElementCollectionlist) {
if (CommonElementCollectionlist.length > 0) {
CollectionForAutoComplete.length = 0;
for (i = 0; i < CommonElementCollectionlist.length; i++) {
CollectionForAutoComplete.push(CommonElementCollectionlist[i].ElementName);
}
}
}
in run time i have loaded the collection and the push the collection into jquery autocomplet. but cache is not to be empty. please tell me how can i clear cache...........
Upvotes: 0
Views: 9041
Reputation: 675
Try this:
$("#setcommonelement_ElementName").result(function()
{
$("#setcommonelement_ElementName").flushCache();
});
Upvotes: 0
Reputation: 11
Try this:
$('#elementoautocomplete').bind("change mouseover click keyup", function() {
$("#elementoautocomplete").flushCache();
});
$('#elementoautocomplete').autocomplete('archive.php', { });
// write this out
Upvotes: 1
Reputation: 175
Simple Solution :
$("#element").unautocomplete();
$("#element").autocomplete(newData);
Upvotes: 0
Reputation: 25472
Set the cache length to 1:
$"#your_selector").autocomplete('/url/',{
...,
cacheLength: 1
});
Upvotes: 0