Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

make sure that no results text is shown

  • Loading branch information...
commit 971a881f51d64b0db7fff82bb9dc561e1f671ce8 1 parent b4ce7eb
@jhanggi jhanggi authored
Showing with 8 additions and 3 deletions.
  1. +8 −3 src/ajax-chosen.coffee
View
11 src/ajax-chosen.coffee
@@ -110,9 +110,14 @@ do ($ = jQuery) ->
.html(element)
.appendTo(select)
- # Tell chosen that the contents of the <select> input have been updated
- # This makes chosen update its internal list of the input data.
- select.trigger("liszt:updated")
+ if Object.keys(items).length
+ # Tell chosen that the contents of the <select> input have been updated
+ # This makes chosen update its internal list of the input data.
+ select.trigger("liszt:updated")
+ else
+ # If there are no results, display the no_results text
+ select.data().chosen.no_results_clear()
+ select.data().chosen.no_results field.attr('value')
# Finally, call the user supplied callback (if it exists)
success(data) if success?
Please sign in to comment.
Something went wrong with that request. Please try again.