matcher.html 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. <section>
  2. <h2 id="compat-matcher">
  3. Simplified function for matching data objects
  4. </h2>
  5. <p class="alert alert-info">
  6. <a href="announcements-4.0.html#new-matcher" class="alert-link">Added in Select2 4.0.0.</a>
  7. This method was added to make upgrading easier from earlier versions of
  8. Select2.
  9. </p>
  10. <p>
  11. During the <a href="announcements-4.0.html">Select2 4.0.0 release</a>, the
  12. <code>matcher</code> function was changed to allow for more complex
  13. matching of nested objects.
  14. </p>
  15. <div class="row">
  16. <div class="col-sm-6">
  17. <dl class="dl-horizontal">
  18. <dt>Key</dt>
  19. <dd>
  20. <code>matcher</code>
  21. </dd>
  22. <dt>Value</dt>
  23. <dd>
  24. A function taking a search <code>term</code> and the data object
  25. <code>text</code>.
  26. </dd>
  27. </dl>
  28. </div>
  29. <div class="col-sm-6">
  30. <dl class="dl-horizontal">
  31. <dt>Adapter</dt>
  32. <dd>
  33. <code title="select2/compat/matcher">oldMatcher</code>
  34. </dd>
  35. </dl>
  36. </div>
  37. </div>
  38. <p>
  39. The <a href="examples.html#matcher">custom matcher example</a> provides a
  40. guide for how to use this in your own application. For those upgrading
  41. from older versions of Select2, you just need to wrap your old
  42. <code>matcher</code> with this function to maintain compatibility.
  43. </p>
  44. </section>