diff --git a/select2-latest.html b/select2-latest.html index e77acb29..021356e1 100755 --- a/select2-latest.html +++ b/select2-latest.html @@ -195,6 +195,7 @@ $("#e10_3").select2({
  • Events: Change
  • Events: Reacting to External Changes
  • Disabled Mode
  • +
  • Custom Matcher Function
  • Documentation
  • @@ -209,6 +210,7 @@ $("#e10_3").select2({
    @@ -610,6 +612,25 @@ $("#e16_disable").click(function() { $("#e16,#e16_2").select2("disable"); }); +
    + +
    +

    Custom Matcher

    +

    Unlike other dropdowns on this page, this one matches options only if the term appears in the beginning of the string as opposed to anywhere

    +


    +
    +
    +

    Example Code

    +
    +           
    +
    +
    @@ -720,6 +741,19 @@ $("#e16_disable").click(function() { $("#e16,#e16_2").select2("disable"); }); The default implementation expects the object to have a id property that is returned. + matcherfunction + Used to determine whether or not the search term matches an option when a built-in query function is used. + The built in query function is used when Select2 is attached to a select, or the local or tags helpers are used. +
    matcher(term, text)
    + + + + + +
    ParameterTypeDescription
    termstringsearch term
    textstringtext of the option being matched
    <returns>booleantrue if search term matches the option text, or false otherwise
    + The default implementation is case insensitive and matches anywhere in ther term: + function(term, text) { return text.toUpperCase().indexOf(term.toUpperCase())>0; } + formatSelectionfunction Function used to render the current selection.
    formatSelection(object)
    diff --git a/select2-master b/select2-master index 4b451fee..4ba25b80 160000 --- a/select2-master +++ b/select2-master @@ -1 +1 @@ -Subproject commit 4b451fee8186af903911263ff756686e62b7e801 +Subproject commit 4ba25b80951f18524f6e9f078e1d1e938975dbac