select2 + 大量记录

select2 + large number of records

我正在使用 select2 下拉菜单。它适用于较少数量的项目。 但是当列表很大时(超过 40000 项)它真的会变慢。它在 IE 中最慢。

否则简单的 Dropdownlist 工作速度非常快,直到 1000 条记录。这种情况有什么解决方法吗?

///////////////**** Jquery Code *******///////////////
var CompanypageSize = 10;

function initCompanies() {
        var defaultTxtOnInit = 'a';
        $("#DefaultCompanyId").select2({
            allowClear: true,
            ajax: {
                url: "/SignUpTemplate/GetCompanies",
                dataType: 'json',
                delay: 250,
                global: false,
                data: function (params) {
                    params.page = params.page || 1;
                    return {
                        keyword: params.term ? params.term : defaultTxtOnInit,
                        pageSize: CompanypageSize,
                        page: params.page
                    };
                },
                processResults: function (data, params) {
                    params.page = params.page || 1;
                    return {
                        results: data.result,
                        pagination: {
                            more: (params.page * CompanypageSize) < data.Counts
                        }
                    };
                },
                cache: true
            },
            placeholder: {
                id: '0', // the value of the option
                text: '--Select Company--'
            },
            width: '100%',
            //minimumInputLength: 3,
        });
    }


//////////******* Have to initialise in .ready *******///////////////

 $(document).ready(function () {

        initCompanies();
    });

//////////******* C# code :: Controller is : SignUpTemplateController************/////

public JsonResult GetCompanies(string keyword, int? pageSize, int? page)
    {
        int totalCount = 0;
        if (!string.IsNullOrWhiteSpace(keyword))
        {
            List<Companies> listCompanies = Companies.GetAll(this.CurrentTenant, (keyword ?? string.Empty).Trim(), false, 11, page.Value, pageSize.Value, ref totalCount, null, null, null, null, null).ToList();
            var list = listCompanies.Select(x => new { text = x.CompanyName, id = x.CompanyId }).ToList();

            return Json(new { result = list, Counts = totalCount }, JsonRequestBehavior.AllowGet);
        }

        return Json(null, JsonRequestBehavior.AllowGet);
    }