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);
}
}
}
在运行时我已经加载了集合并将集合推入jquery autocomplet。但缓存不是空的。请告诉我如何清除缓存...........
答案 0 :(得分:1)
试试这个:
$('#elementoautocomplete').bind("change mouseover click keyup", function() {
$("#elementoautocomplete").flushCache();
});
$('#elementoautocomplete').autocomplete('archive.php', { });
// write this out
答案 1 :(得分:0)
试试这个:
$("#setcommonelement_ElementName").result(function()
{
$("#setcommonelement_ElementName").flushCache();
});
答案 2 :(得分:0)
将缓存长度设置为1:
$"#your_selector").autocomplete('/url/',{
...,
cacheLength: 1
});
答案 3 :(得分:0)
简单解决方案:
$("#element").unautocomplete();
$("#element").autocomplete(newData);