0

I have HTMl like this:

<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});

My page loads very slow because I have more than 4000 records, and page loads them all at once. Is there any other way, how can I solve this.

jomskris
  • 279
  • 2
  • 16
  • Im not seeing an element with the `.select` class? also is there not a way to load it async? – akaBase Aug 14 '19 at 11:55
  • You can paginate the results, an explained here : https://stackoverflow.com/questions/32533757/select2-v4-how-to-paginate-results-using-ajax or here https://stackoverflow.com/questions/54821596/select2-is-slow-on-opening-with-10-000-elements – Altherius Aug 14 '19 at 11:55
  • Possible duplicate of [Select2 is slow on opening with 10.000+ elements](https://stackoverflow.com/questions/54821596/select2-is-slow-on-opening-with-10-000-elements) – Altherius Aug 14 '19 at 11:56

0 Answers0