Frank7390035
Posts: 0
Joined: Thu Feb 19, 2015 1:37 am

autocomplete / number of rows shown

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

Serhii Kulibaba
Posts: 150
Joined: Tue Aug 27, 2013 1:47 pm

autocomplete / number of rows shown

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?

Frank7390035
Posts: 0
Joined: Thu Feb 19, 2015 1:37 am

autocomplete / number of rows shown

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.

Frank7390035
Posts: 0
Joined: Thu Feb 19, 2015 1:37 am

autocomplete / number of rows shown

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

e.g. item in itemlist | filter:inputsearch

Return to “Issues”