Skip to content

Commit

Permalink
Merge pull request #66 from lerasah/noresultshtmlmessage
Browse files Browse the repository at this point in the history
Display HTML error message
  • Loading branch information
biggora committed Mar 12, 2018
2 parents ae5da74 + 5719be4 commit 530ae7f
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion js/bootstrap-typeahead.js
Expand Up @@ -22,6 +22,9 @@
options.items = 100;
options.menu = '<ul class="typeahead dropdown-menu" style="max-height:220px;overflow:auto;"></ul>';
}

// html content to display when no results are found
options.resultNotFoundMsgBody = "<div><p>Sorry! We've got no result for your query</p></div>";

var that = this;
that.$element = $(element);
Expand Down Expand Up @@ -237,7 +240,8 @@
}
//Bhanu added a custom message- Result not Found when no result is found
if (items.length == 0) {
items[0] = {'id': -21, 'name': "Result not Found"}
items[0] = {'id': -21, 'name': that.options.resultNotFoundMsgBody};
return that.render(items.slice(0, that.options.items), false).show();
}
return that.render(items.slice(0, that.options.items)).show();
}
Expand Down

0 comments on commit 530ae7f

Please sign in to comment.