You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cordova.apache.org by "Shazron Abdullah (Updated) (JIRA)" <ji...@apache.org> on 2011/11/29 05:53:40 UTC
[jira] [Updated] (CB-58) Feature request: contacts.find API too
slow for autocomplete. provide max contact objects option.
[ https://issues.apache.org/jira/browse/CB-58?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Shazron Abdullah updated CB-58:
-------------------------------
Priority: Minor (was: Major)
> 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 Callback
> 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: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira