title: How to use local json array and infinite scroll together in Select2 4.0?
body: <p>Since it's expensive to create/remove a lot of <code>&lt;option&gt;</code> tags on the DOM, I'm looking for a way to use large local JSON along with infinite scroll in Select2 4.0. I also want to be able to properly get/set/update values. There is <a href="https://stackoverflow.com/questions/32756698/how-to-enable-infinite-scrolling-in-select2-4-0-without-ajax">this stackoverflow question</a> (of which I provided a muddy solution) but my solution has 2 problems:</p>
  
  <ol>
  <li><p>I can clear out unselected options in the single source select and the Select2 control will not break. This keeps unneeded options from building up in the source select (since I'm using a local JSON array for data). However, if I try to do the same for multiple selects this will break functionality in Select2. See this section in the jsFiddle example:</p>
  
  <pre><code>if(!this.$element.prop('multiple')){
      findValue = [findValue];
      this.$element.html();     // &lt;-- if I do this for multiple then it breaks
  }
  </code></pre></li>
  <li><p>This overall solution is convoluted. Is there a better way to accomplish having large local JSON and infinite scroll in Select2 (with ability to get/set/update values as shown in the fiddle below)?</p></li>
  </ol>
  
  <p>Here's my full <a href="http://jsfiddle.net/a8La61rL/" rel="nofollow noreferrer">jsFiddle here</a>.</p>