Permalink
Browse files

make sure that no results text is shown

  • Loading branch information...
1 parent b4ce7eb commit 971a881f51d64b0db7fff82bb9dc561e1f671ce8 @jhanggi jhanggi committed Nov 29, 2012
Showing with 8 additions and 3 deletions.
  1. +8 −3 src/ajax-chosen.coffee
View
@@ -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?

0 comments on commit 971a881

Please sign in to comment.