-
Notifications
You must be signed in to change notification settings - Fork 3.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use Twitter and Bootstrap Typeahead together #119
Comments
It's not recommended to use both typeahead.js and Bootstrap's typeahead plugin. Having said that, if you wanted to do it, all Bootstrap plugins have $.fn.bootstrapTypeahead = $.fn.typeahead.noConflict(); |
Many thanks @jharding - that's helpful. May I ask, just before closing this issue, why the recommendation not to use both at the same time? |
Well they serve the same purpose, it's just that typeahead.js offers more functionality out of the box. If you don't need the extra functionality, you should just use Bootstrap's typeahead. |
Thanks for the reply. Your answer indicates that I have probably not communicated the issue very well - sorry. Please let me try again. While TTA definitely has useful functionality beyond what BTA provides, TTA seems to be missing at least a couple bits of functionality available in BTA, including:
I use both of these, and so it would seem that I cannot replace BTA with TTA, without significant issue, to take advantage of the extra functionality in TTA. So while I would like to use it, TTA does not appear to be a drop-in replacement for BTA because of at least the above issues - unless I misunderstand or overlooked something. If the noted features are not already present, perhaps I should open issues for the above items? |
Feel free to create an issue for this.
How exactly are you using this? Depending on that, v0.9.0 might introduce the functionality you're looking for. |
Many thanks. I submitted issue #120 regarding the first point. Right now I am passing a function as the Essentially the source may be a function with one of two formats: Synchronous:function source(param) {
results = something_synchronous;
return results;
} Asynchronousfunction source(param, callback) {
do_something_async(function (results) { callback(results) });
} Offhand I am not sure what method Bootstrap Typeahead is using to determine if the
Alternatively it can sort-of "duck"-type and use the return (if defined) and in any case update the results when the async callback is called with new results. Is that helpful? |
Yeah thanks. I'm curious as to what you use |
Oh sorry, yes - I use typeahead to autocomplete form fields, but the sources themselves are either other form fields or constructions of those fields. For example a set of fields may have a Also sometimes fields will autocomplete computed values. For example, an address may be represented across multiple distinct fields - eg name, street, city, etc. however in places these fields are combined and auto-complete suggest full addresses. The components that constitute the addresses may also be modified dynamically in the browser. Incidentally: All of this dynamic data flows from two way client side binding with knockout.js (n my case) though other dynamic apps may use eg angular.js. I hope this is helpful. |
Another use case is when the client info is dynamically determined. For example when the source may be X or Y depending on whether a certain condition is met e.g. a checkbox is set. |
Alright so it sounds like for your use case, you need to be able to dynamically change |
It would seem that Twitter Typeahead (TTA) and Bootstrap Typeahead (BTA) both occupy the identifier
$.typeahead
.It seems that TTA is mean to be Bootstrap-compatible, as the documentation indicates that one could simply add TTA after BTA.
How might one concurrently use both BTA and TTA?
Since BTA is not (yet) a proper subset of TTA functionality (eg BTA can show suggestions drop-down even without input by setting
minLength
to 0, TTA does not seem to have this), it would seem that that this is desirable in certain cases.See also the Stackoverflow question
The text was updated successfully, but these errors were encountered: