Bootstrap 标签输入缓存数据
Bootstrap tags input caching data
我正在使用 typeahead js 输入的 boostrap 标签。但是更新数据库后数据没有更新。
我在我的应用程序中使用服务来提供数据。
此致。
这里是我使用的代码:
var citynames = new Bloodhound({
datumTokenizer: Bloodhound.tokenizers.obj.whitespace('name'),
queryTokenizer: Bloodhound.tokenizers.whitespace,
prefetch: {
url: '@Url.Action("GetTagsJson", "Tags")',
filter: function (list) {
return $.map(list, function (cityname) {
return { name: cityname };
});
}
}
});
citynames.initialize();
$('#userTags').tagsinput({
typeaheadjs: [{
minLength: 1,
highlight: true
}, {
minLength: 1,
name: 'citynames',
displayKey: 'name',
valueKey: 'name',
source: citynames.ttAdapter()
}],
freeInput: true
});
citynames.clearPrefetchCache();
citynames.initialize(true);
使用这个。它将在加载时清除缓存并更新新数据
我正在使用 typeahead js 输入的 boostrap 标签。但是更新数据库后数据没有更新。
我在我的应用程序中使用服务来提供数据。
此致。
这里是我使用的代码:
var citynames = new Bloodhound({
datumTokenizer: Bloodhound.tokenizers.obj.whitespace('name'),
queryTokenizer: Bloodhound.tokenizers.whitespace,
prefetch: {
url: '@Url.Action("GetTagsJson", "Tags")',
filter: function (list) {
return $.map(list, function (cityname) {
return { name: cityname };
});
}
}
});
citynames.initialize();
$('#userTags').tagsinput({
typeaheadjs: [{
minLength: 1,
highlight: true
}, {
minLength: 1,
name: 'citynames',
displayKey: 'name',
valueKey: 'name',
source: citynames.ttAdapter()
}],
freeInput: true
});
citynames.clearPrefetchCache();
citynames.initialize(true);
使用这个。它将在加载时清除缓存并更新新数据