带有形式的Select2非常慢

时间:2019-08-14 11:47:53

标签: javascript jquery

我有这样的HTMl:

<form id="successorsForm" action="/app/details/Successors" method="post">
   <fieldset>

    <select class="form-control select2" data-live-search="true" 
id="link0.discId" name="link[0].discId"
         data-select2-id="link0.discId" tabindex="0" aria-hidden="false">
        <option value="1" data-select2-id="1">Item 1</option>
        <option value="2" data-select2-id="2">Item 2</option>
        .....
        .....
    </select>

    <select class="form-control select2" data-live-search="true" 
id="link1.discId" name="link[1].discId"
        data-select2-id="link1.discId" tabindex="0" aria-hidden="false">
        <option value="1" data-select2-id="3">Item 1</option>
        <option value="2" data-select2-id="4">Item 2</option>
        ......
        ......
    </select>
  </fieldset>
</form>

JS

 $(".select2").select2({width: '100%',  minimumInputLength: 3});

我的页面加载非常慢,因为我有4000多个记录,并且页面一次加载了所有记录。还有其他方法,我该如何解决。

0 个答案:

没有答案