           results: formatted_taxon_concepts
           more: more
     })
+
+  sortByText: (results) ->
+    query = $('.select2-search__field').val().toUpperCase()
+    results.sort (a, b) ->
+      firstPos = a.text.toUpperCase().indexOf(query.toUpperCase())
+      secondPos = b.text.toUpperCase().indexOf(query.toUpperCase())
+      return firstPos - secondPos

  select2TaxonConcept: ->
    $("#taxon_name_dropdown").select2({
      minimumInputLength: 3
      quietMillis: 500,
      ajax:
        url: "#{@state.apiBaseUrl}/api/v1/auto_complete_taxon_concepts.json"
        dataType: 'json'

    $("##{@state.name}_dropdown").select2({
      placeholder: @state.placeholder,
      data: data
      sorter: @sortByText
    })

  componentDidUpdate: ->
