angular-ui / bootstrap

PLEASE READ THE PROJECT STATUS BELOW. Native AngularJS (Angular) directives for Bootstrap. Smaller footprint (20kB gzipped), no 3rd party JS dependencies (jQuery, bootstrap JS) required. Please read the README.md file before submitting an issue!
http://angular-ui.github.io/bootstrap/
MIT License
14.27k stars 6.73k forks source link

Typeahead: live source #2388

Open musketyr opened 10 years ago

musketyr commented 10 years ago

I would like to build an omnisearch box similar to one GitHub has. For that case it would be great if the typeahead would watch the changes in the array returned from the source. In that case I can preload some results (e.g. search actions) statically and the rest add dynamically when the http request to the backend is finished.

musketyr commented 10 years ago

another - maybe simpler to implement - option to implement this would be register update handler for the source promise as well so you can supply the intermediate results on the fly.

pkozlowski-opensource commented 10 years ago

@musketyr actually this work as you expect already, at least I can't think of anything that would prevent thigs working like this. What did you try? What problems did you face? Please send a minimal plunk with a live reproduce scenario, otherwise it is impossible to suggest solutions (see https://github.com/angular-ui/bootstrap/blob/master/CONTRIBUTING.md#you-think-youve-found-a-bug)

musketyr commented 10 years ago

I've created plunk for you. in this example I would like to see the Paris, France immediately before the getLocation() function finishes fetching the real results.

rvanbaalen commented 9 years ago

@musketyr If I understand you correctly, you want the typeahead to have a default value before you start initiating the async call? Like this: http://plnkr.co/edit/4Aq2DUIQ4yclWZeIcWB8 ?

Seems like a support question rather than a bug report to me.

musketyr commented 9 years ago

no, this is not the issue at all. please, reopen the issue.

let's try it again:

I have a typeahead (let's say for location as in that plunk. and I have some preferred/predefined select options (not preselected/default value as you suggested) and as calls to getLocation() function can take a while I would like to show these select options before the the function completes. the general case is that if I have paginated results in that async call and want to show the select options from the first page of results as soon as I fetch them and don't want to wait until I finish reading all pages I should be able to post the provisional results to promise.notify and when I fetch all pages I can finally call promise.resolve

The implementation shouldn't be that difficult. There only thing which is basically needed is to put the third callback to this call https://github.com/angular-ui/bootstrap/blob/master/src/typeahead/typeahead.js#L128 but I'm not able to send a pull request as I'm not sure how to write a unit test for it.

wesleycho commented 9 years ago

This is reasonable - I will see if we can get this implemented sometime soon.

musketyr commented 9 years ago

Great, thank you!

On Sat, Aug 1, 2015 at 8:57 PM Wesley Cho notifications@github.com wrote:

This is reasonable - I will see if we can get this implemented sometime soon.

— Reply to this email directly or view it on GitHub https://github.com/angular-ui/bootstrap/issues/2388#issuecomment-126945118 .

iamFIREcracker commented 9 years ago

Adding another example to the table.

I find myself in a situation where the entries of my popup should be fetched from different remote services, and right now I have a function in charge of firing the requests, wait for the responses, and return the aggregated set of options to the engine.

The problem with this approach is that the popup will be shown to the user only when all the options have been collected locally. On the other hand, if the entries of the popup were bound to a user provided collection, retrieved options could be pushed into this collection as soon as possible.

This seems to be related (I did not try the proposed changes though): https://github.com/angular-ui/bootstrap/issues/2654

iamFIREcracker commented 9 years ago

While still related, that issue does not contain a workaround to bind options to a collection; this does: https://github.com/angular-ui/bootstrap/issues/3011

madhansekar commented 8 years ago

Hi im facing issue in typehead which is inside grid cell template and its not showing dropdown in IE11 but its working fine in Chrome browser can any one help me in this issue

icfantv commented 8 years ago

@madhansekar, Hi there! Two things:

  1. Please read and follow our project documentation by not using the issues forum for support requests. The issues forum is reserved for bugs. Also, asking for help on existing issues is a good way for your request to get missed.
  2. You have given us absolutely nothing to go on to help you discover the source of your problem. When asking for help, be it anywhere, providing as much information as possible (including a working plunker) is big imperative and respectful of other people's time.
worthy7 commented 7 years ago

So this still isn't done.