Ver Mensaje Individual
  #9 (permalink)  
Antiguo 06/05/2016, 14:33
Avatar de kip13
kip13
 
Fecha de Ingreso: agosto-2011
Mensajes: 167
Antigüedad: 12 años, 8 meses
Puntos: 13
Respuesta: proble con la cantidad de registros de Control select2

De esto es lo que yo hablo, traer los datos generados de la consulta en un Json mediante Ajax y con scroll infinito.

Este es un ejemplo que copie de la documentacion:

Infinite Scroll with Remote Data

Cita:
Select2 supports lazy-appending of results when the result list is scrolled to the end. In order to enable the remote service must support some sort of a paging mechanism and the query function given to Select2 must take advantage of it. The following example demonstrates how this can be set up.

Código Javascript:
Ver original
  1. $("#e7").select2({
  2.     placeholder: "Search for a repository",
  3.     minimumInputLength: 3,
  4.     ajax: {
  5.         url: "https://api.github.com/search/repositories",
  6.         dataType: 'json',
  7.         quietMillis: 250,
  8.         data: function (term, page) { // page is the one-based page number tracked by Select2
  9.             return {
  10.                 q: term, //search term
  11.                 page: page // page number
  12.             };
  13.         },
  14.         results: function (data, page) {
  15.             var more = (page * 30) < data.total_count; // whether or not there are more results available
  16.  
  17.             // notice we return the value of more so Select2 knows if more results can be loaded
  18.             return { results: data.items, more: more };
  19.         }
  20.     },
  21.     formatResult: repoFormatResult, // omitted for brevity, see the source of this page
  22.     formatSelection: repoFormatSelection, // omitted for brevity, see the source of this page
  23.     dropdownCssClass: "bigdrop", // apply css that makes the dropdown taller
  24.     escapeMarkup: function (m) { return m; } // we do not want to escape markup since we are displaying html in results
  25. });


Se que en el ejemplo esta en una url remota pero puedes adaptarlo a lo que tu necesitas.

Fuente: Link de doc

Ojala te sirva