biggora / bootstrap-ajax-typeahead

Twitter Bootstrap Ajax Typeahead Plugin
http://plugins.upbootstrap.com/bootstrap-ajax-typeahead/
MIT License
172 stars 117 forks source link

Default ajax option is not null #39

Open wimski opened 8 years ago

wimski commented 8 years ago

In the option table it says the ajax option (whether object or string) is null by default. This isn't true, because in the $.fn.typeahead.defaults the ajax option is a predefined object. So unless you specifically tell your instance to have an ajax option of null, the ajax option will not be null. I came across this when the sorter method didn't seem to work. It turns out the sorting is skipped when the ajax option is set. I only used the source option, but it didn't sort until I specifically set the ajax option to null.

So either have the default value actually be null or edit the options table in the documentation to reflect the predefined ajax object.

wimski commented 8 years ago

Created a pull request for this issue. I added an extra check to see if the url property of the ajax option is set: pull request #40 Also added support for sorting objects.