Skip to content
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

How to show a suggestions list when input field is empty ? #107

Closed
ghiaia opened this issue Jan 2, 2015 · 12 comments
Closed

How to show a suggestions list when input field is empty ? #107

ghiaia opened this issue Jan 2, 2015 · 12 comments

Comments

@ghiaia
Copy link

ghiaia commented Jan 2, 2015

I need to show a list of values before user enters any char in input fields (empty and just focused).
Values come from an history of recents, so user can reuse before searching.
Is it possible ? How ?
Thanks

@elifio
Copy link

elifio commented Feb 2, 2015

1+

@Kisama
Copy link

Kisama commented Feb 2, 2015

Set minlength "0" and down arrow. You can show all list with empty search
text
On 2015년 2월 2일 (월) at 오후 8:54 elifio notifications@github.com wrote:

1+


Reply to this email directly or view it on GitHub
#107 (comment)
.

@elifio
Copy link

elifio commented Feb 3, 2015

Not work for me.
I want to show all results (7 names in the example)
I set the length to 0 and key pressed down (maybe not know any names)

you can show in this plunker with the last version

http://embed.plnkr.co/BrHLIVysK71qr2ghZ4fT/preview

@Kisama
Copy link

Kisama commented Feb 3, 2015

I need to check version that I used tomorrow.
I think maybe I use older version,

I check the current source and found there are some validation logic to
prevent search with empty string.

2015-02-03 21:43 GMT+09:00 elifio notifications@github.com:

Not work for me.
I want to show all results (7 names in the example)
I set the length to 0 and key pressed down (maybe not know any names)

you can show in this plunker with the last version

http://embed.plnkr.co/BrHLIVysK71qr2ghZ4fT/preview


Reply to this email directly or view it on GitHub
#107 (comment)
.

@tamilp
Copy link

tamilp commented Feb 25, 2015

Yes, minlength = 0 not working, what is the solution ?

@tamilp
Copy link

tamilp commented Feb 26, 2015

i was done for my own, whether it is right or wrong don't know but finally worked for me

  1. set minlength = 0;

  2. Comment the below code in your angucomplete-alt.js file, around 255 line

      else {
        /*if (!scope.searchStr || scope.searchStr === '') {
          scope.showDropdown = false;
        } else*/ if (scope.searchStr.length >= minlength) {
          initResults();
    
          if (searchTimer) {
            $timeout.cancel(searchTimer);
          }
    
  3. Comment the below code in your angucomplete-alt.js file, around 489 line

    function searchTimerComplete(str) {
      // Begin the search
      /*if (!str || str.length < minlength) {
        return;
      }*/
      if (scope.localData) {
        scope.$apply(function() {
          getLocalResults(str);
        });
      }
    

@ghiden
Copy link
Owner

ghiden commented Mar 20, 2015

I never implemented this as I thought showing a list without any input feels wrong for autocomplete. I'll think about this.

@ghiden
Copy link
Owner

ghiden commented Mar 26, 2015

I just want to make sure the problem here. This feature is to show all items when user focus on the input field rendered by this directive, right? And, this is only valid for local data, correct? In other words, I don't think that the remote API returns all results with supplying query term of what? So, I think this is only useful or usable for local data. Am I correct?

@winiciuswanderlei
Copy link

Correct, at least to my point of view.

@ghiaia
Copy link
Author

ghiaia commented Mar 26, 2015

In absence of user indications (input field void) the remote server can
produce a initial list of "suggestions", ie a list of tipical choices
(based on history, other fields values or something else usefull to guide
the user to an immediate easy response)
This list is preloaded on init or on change in other input o event.
When user types something (instead of select from the list) the usual
typeahead list substitues the first.

2015-03-26 9:51 GMT+01:00 Hidenari Nozaki notifications@github.com:

I just want to make sure the problem here. This feature is to show all
items when user focus on the input field rendered by this directive, right?
And, this is only valid for local data, correct? In other words, I don't
think that the remote API returns all results with supplying query term of
what? So, I think this is only useful or usable for local data. Am I
correct?


Reply to this email directly or view it on GitHub
#107 (comment)
.

Marco Vaccari

Vaccari A. Giulio S.p.A.
Via Chemello, 12/D
I36075 Montecchio Maggiore
VICENZA ITALY
xx39-0444-492330 (tel)
xx39-0444-694747 (fax)

@winiciuswanderlei
Copy link

Here ran as follows, creates a function:

scope.nameFunction = function () {
processResults(scope.localData, '');
scope.showDropdown = true;
}

On line 51 in input add the even ng-click="nameFunction()':
' <input ng-click="nameFunction()" ...

I do not know if it's the right way but it worked for me.

@ghiden
Copy link
Owner

ghiden commented Mar 30, 2015

Released in v0.0.38

@ghiden ghiden closed this as completed Mar 30, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants