【问题标题】:Select2 showing all the resultsSelect2 显示所有结果
【发布时间】:2014-02-27 18:46:33
【问题描述】:

我写了任何文本,它会显示与文本不匹配的结果。 无论我在字段中插入什么,select2 总是给出所有结果。

$("#UserCliente").select2({
     minimumInputLength: 3,
     ajax: { // instead of writing the function to execute the request we use Select2's convenient helper
    url: "../clients/listaclients/",
    dataType: 'json',
    data: function (term) {
        return {
            term: term, // search term
        };
    },
    results: function (data) { // parse the results into the format expected by Select2.
        // since we are using custom formatting functions we do not need to alter remote JSON data
        return {results: data};
    }
},


});

发生了什么事?

【问题讨论】:

    标签: jquery jquery-plugins jquery-select2


    【解决方案1】:

    我找到了解决方案。 很简单:我的 json 总是返回所有结果。我在 php 中进行了更改以搜索 term 并带来结果。 谢谢

    【讨论】:

      猜你喜欢
      • 2016-04-10
      • 2016-09-11
      • 1970-01-01
      • 2015-11-01
      • 2013-06-12
      • 2020-01-25
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多