Skip to content

Commit 43a3150

Browse files
author
Tomas Kirda
committed
Call beforeRender even if there are no suggestions. Closes #507
1 parent a279fe9 commit 43a3150

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

src/jquery.autocomplete.js

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -719,6 +719,7 @@
719719

720720
noSuggestions: function() {
721721
var that = this,
722+
beforeRender = that.options.beforeRender,
722723
container = $(that.suggestionsContainer),
723724
noSuggestionsContainer = $(that.noSuggestionsContainer);
724725

@@ -727,9 +728,15 @@
727728
// Some explicit steps. Be careful here as it easy to get
728729
// noSuggestionsContainer removed from DOM if not detached properly.
729730
noSuggestionsContainer.detach();
730-
container.empty(); // clean suggestions if any
731+
732+
// clean suggestions if any
733+
container.empty();
731734
container.append(noSuggestionsContainer);
732735

736+
if ($.isFunction(beforeRender)) {
737+
beforeRender.call(that.element, container, that.suggestions);
738+
}
739+
733740
that.fixPosition();
734741

735742
container.show();

0 commit comments

Comments
 (0)