Page 1 of 1

autocomplete / number of rows shown

Posted: Fri Apr 21, 2017 1:25 pm
by Frank7390035

Hello,

I have implemented autcomplete in ionic but there's a small glitch:

-let's say I limit the number of suggestions to 5 using a limit in the db query
-let's say that the db first returns 5 suggestions, but as I keep typing it will the return only 2 suggestions
-my autocomplete list still shows 5 rows with words with rows n. 3,4,5 having results from the previous query.

I'd like to fix this in some way e.g. ng-show/ng-hide but I don't know how to get the number of results returned to apply the condition. Is there another/better way of doing this?

Thanks!
Frank


autocomplete / number of rows shown

Posted: Fri Apr 21, 2017 5:39 pm
by Serhii Kulibaba

Hello Frank,

Please clarify, how do you run the search request to the database and what value of the "where" parameter do you use there?


autocomplete / number of rows shown

Posted: Fri Apr 21, 2017 5:54 pm
by Frank7390035

Hi Serhil,

Thanks for the quick reply.

The input form has the following:

ng-change - calls a function e.g. getList()

The function makes a request via a REST service.

So each time an additional letter is entered a new query runs.

The results of the query are saved to a model variable which then populates the list.

But somehow the list that populates the screen is never destroyed/reinitialized when I type a new letter.


autocomplete / number of rows shown

Posted: Sat Apr 22, 2017 5:20 pm
by Frank7390035

just a note, I solved it by adding a filter to ng-repeat

e.g. item in itemlist | filter:inputsearch