-
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
MouseEnter & Typeahead: Selected Custom Queries #165
Comments
I've considered adding some sort of mouseover/mouseleave events, but I need to think it through some more. The good news is that I think I have a hack that may work for you. Each suggestion in the dropdown menu has a data property named $('.twitter-typeahead').on('mouseover', '.tt-suggestion', function($e) {
var $suggestion = $($e.currentTarget),
datum = $suggestion.data('suggestion').datum;
$suggestion.trigger('typeahead:mouseover', datum);
}); There's no guarantee that this will be compatible with future versions of typeahead.js, but it should work for now.
Feel free to use $('.typeahead').typeahead('setQuery', 'query goes here'); Hope this helped. |
I was able to get the submenu to attach and retrieve the datum object using on-mouse events. When I added the setQuery function I didn't realize at the time that it would render a display in the main window and change the query. I was hoping to render the returned data objects from setQuery into the new submenu: The code below is around line 979 in the function _getSuggestions:
The data objects I would like returned are in the variable "suggestions". Is there an easy way I could call getSuggestions directly? I could check for a new parameter and bypass "renderSuggestions" above. Something like:
Where "false" would be the new bypass parameter. Thanks, |
Not yet. I'm using #95 to track exposing the dataset API. |
OK. I will post there.... Thanks. |
Closing as this issue seems dependent on #95. |
I'm having a great time working with typeahead.js. Intelligent queries, prefetch and local storage has gotten me busy building a prototype. Brilliant.
I'm currently using it to display items within categories, lot's of categories with subcategories. Since the dropdown needs to be limited in number of items and each subcategory has no more that 15 items there are two things I would like to try to launch a submenu using the following process:
Retrieve the current datum object, preferably during mouse-enter/over event. If that's not currently possible, use "typeahead: selected" (currently doing this), but keep the drop-down from closing if a submenu is open.
Launch a custom query based upon the selected datum
Display the selected objects in a submenu.
I can handle the submenu (item 3). Are items 1 and 2 possible at this time? I'm almost there and hoping I can hack it out if possible. Should I look at the undocumented setQuery that you just released? Not sure how to use it.
Thanks,
B
The text was updated successfully, but these errors were encountered: