Disable term search ajax, enable pagination

I need:
-Load initial data contents by ajax.
-Disable realtime term search with Ajax
-Enable pagination, but with special code ( not page 1, page 2 page 3…)

Any trick?

Thanks for advance!!!

You can use “regular” JavaScript AJAX techniques (e.g., JQuery’s AJAX capability) to retrieve your data from the server and pass it to Select2 as a JavaScript array (just be sure the objects in the array are in the required format. In this case the realtime search will not trigger any AJAX requests since you aren’t using Select2’s AJAX feature to retrieve the data.

I’m not sure what you mean by “Enable pagination, but with special code”. If you are using a JavaScript array as the datasource, the entire data set is rendered into the Select2 at once—there is no pagination. If you want to display the results a “page” at a time, you could probably use a custom templateResult callback to decide which “page” of results to show. But this really depends on what kind of pagination you want to do, and your description doesn’t have enough detail for me to give you more specific help.