1

The select2 can contain even 10k-20k options. This is the code:

<select class="meds-single-select w-100" name="meds" id="meds">
                    @if( $items->count() )
                        @foreach ($items as $item)
                            <option value="{{ $item->id }}">{{ $item->name }}</option>
                        @endforeach
                    @endif
                    </select>

I am getting the items from the database, obviously. What I want to do is to render only the first 20 options, and then render the next 20 options if I scroll down and so on. Found a thread here on stackoverflow but it doesn't apply to my code unfortunately

Cristian25
  • 129
  • 1
  • 6
  • Does this answer your question? [Select2 v4 how to paginate results using AJAX](https://stackoverflow.com/questions/32533757/select2-v4-how-to-paginate-results-using-ajax) – hassan May 20 '22 at 18:46
  • 1
    Hold all the data serverside, and make API calls to retrieve/query/page through it – Rory McCrossan May 20 '22 at 18:51

0 Answers0