[ 
https://issues.apache.org/jira/browse/CB-58?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13759956#comment-13759956
 ] 

Kenton Gray commented on CB-58:
-------------------------------

I believe this should be reconsidered as the Contacts API has a limit option 
(not sure if this was not there at the time of the previous comments)
http://www.w3.org/TR/contacts-api/
"limit of type unsigned long, nullable
By default a contact service may return as many contacts as the user selects. 
If limit is specified, the contact service must not return more than limit 
contacts. The contact service should enforce this limitation in the user 
interface that it exposes."

I think this would be relatively trivial and am willing to handle the task if 
the Cordova project is interested in merging. What is the best way to submit 
changes like this?
                
> Feature request: contacts.find API too slow for autocomplete. provide max 
> contact objects option.
> -------------------------------------------------------------------------------------------------
>
>                 Key: CB-58
>                 URL: https://issues.apache.org/jira/browse/CB-58
>             Project: Apache Cordova
>          Issue Type: New Feature
>          Components: iOS
>            Reporter: Shazron Abdullah
>            Priority: Minor
>
> reported at: https://github.com/phonegap/phonegap-iphone/issues/56
> by: https://github.com/hardeep
> I am trying to use the contacts.find api to fill in an autocomplete box. It 
> is too slow to be useful in this context.
> Please provide a way to limit the number of contact objects returned from the 
> contacts.find api.
> Possibly add a new option to contactFindOptions, something like 
> "maxContacts". For example:
>   maxContacts: Determines how many contact objects the find operation should 
> return. (Integer) (Default: 1000)
> Here is a code snippet of what I am trying to do:
>     $(’#contacts input:last’).autocomplete({source: function 
> (request, response) {
>       options = new ContactFindOptions();
>       options.filter = request.term;
>       options.multiple = true; 
>       fields = ["displayName", "phoneNumbers", "emails"];
>       navigator.service.contacts.find(fields,
>         function (contacts) {
>           var responseList = [];
>           console.log(’contacts found for ’ + request.term + 
> ’: ’ + contacts.length);
>           $.each(contacts, function (index, contact) {
>             //console.log(contact);
>             // limit to 10 autocomplete contacts
>             // note: the contacts.find api takes a long time to return when 
> there are
>             // many contacts that match the options.filter
>             if (index > 10) {
>               return false;  // break
>             }
> [Original LightHouse 
> ticket](http://phonegap.lighthouseapp.com/projects/20116/tickets/146)
>  This ticket has 0 attachment(s).

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

Reply via email to