jQuery自动完成不会显示超过10个结果 [英] jQuery autocomplete won't show more than 10 results

查看:71
本文介绍了jQuery自动完成不会显示超过10个结果的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用jQuery自动完成功能,无论我更改了什么设置,我都无法在下拉菜单中显示超过10个结果。我可以在结果中看到我从服务器获得所有这些,但前端不会显示超过10个。

I'm using the jQuery autocomplete, and no matter what settings I change, I can't get it to show more than 10 results in the dropdown. I can see in the results coming back that I'm getting all of them from the server, but the front end won't show more than 10.

$("#add_cpt_code_text").autocomplete('<%: Url.Action("SearchCPT", "ChargeCapture") %>', {
    autoFill: false,
    mustMatch: true,
    matchContains: true,
    cacheLength: 1,
    maxItemsToShow: 15,
    minChars: 3,
    extraParams: {
        LocationID: 0
    },
    formatItem: function (data, index, max) {
        return data[1];
    },
    formatMatch: function (data, index, max) {
        return data[1];
    },
    formatResult: function (data, index, max) {
        return data[1];
    }
}).result(function (event, data, formatted) {
    if (data) {
        $("#add_cpt_code_id").val(data[0]);
        $("#add_cpt_code_text").val(data[1]);
    }
    else {
        $("#add_cpt_code_id").val('');
    }
});


推荐答案

我找到了答案,我需要使用max,不是maxItemsToShow

I found the answer, I need to use max, not maxItemsToShow

我使用的是jquery-ui自动完成

I was using the jquery-ui autocomplete

这篇关于jQuery自动完成不会显示超过10个结果的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆