【问题标题】:Bootstrap tags input caching data引导标签输入缓存数据
【发布时间】:2017-03-01 22:37:24
【问题描述】:

我正在使用带有 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
    });

【问题讨论】:

    标签: typeahead.js bootstrap-tags-input


    【解决方案1】:
    citynames.clearPrefetchCache();
    citynames.initialize(true);
    

    使用这个。它会在加载时清除缓存并更新新数据

    【讨论】:

      猜你喜欢
      • 2015-11-10
      • 1970-01-01
      • 1970-01-01
      • 2014-10-07
      • 1970-01-01
      • 2013-07-11
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多