Select2 slow with large amount of rows returned

I have a form where the user needs to select a student from a list to enter the training.
They either have a Fist name, Last name or cel number.
The list of initial rows is more than 30,000 rows.
When the initial field opens it takes a long time to open. So I suspect that the system is build a list of 30000 records with information and sending that to the browser for it to be searched. This works well if the records are less than 7000.

I think i have developers block as I can’t think of another way to search, display the records and return the selected ID.

Any suggestions.

Can you set it so that it doesn’t start searching until they enter 3 characters?

I am not sure if there is such an option.
I changed the approach to that have a field first that the person would be search for and than build the select 2 on with that data.

Not sure if there is better way

1 Like