1. #1
    Sencha User
    Join Date
    Dec 2009
    Posts
    377
    Vote Rating
    3
    Answers
    1
    raj_plays is on a distinguished road

      0  

    Default Answered: cordova-plugin-contacts not working

    Hi,
    I use the cordova-plugin-contacts plugin to read contacts from my device and display them.
    The code below is able to read the contact and fetch it. I know this because I get the alert but it doesn't display it in the list. This code is in the launch of my controller.
    Code:
    var options = new ContactFindOptions();
            options.filter="";
            options.multiple = true;
            var fields = ["displayName"];
            navigator.contacts.find(fields, function(contacts) {
               
                var data = []; 
                for (var i=0; i<contacts.length; i++)
                    data.push({name: contacts[i].displayName});
                
                Ext.Msg.alert('Title1', data[0].name, Ext.emptyFn);    
                
                this.getMainView().down('#contactList').getStore().applyData(data);
                },
                function(msg) {
                    Ext.Msg.alert('Error', msg);
            }, options);
    Please help.

  2. Please ignore this thread.
    The problem was with scope.
    "this" inside the find function referred to the navigator obj not the controller.

  3. #2
    Sencha User
    Join Date
    Dec 2009
    Posts
    377
    Vote Rating
    3
    Answers
    1
    raj_plays is on a distinguished road

      0  

    Default

    Please ignore this thread.
    The problem was with scope.
    "this" inside the find function referred to the navigator obj not the controller.

Similar Threads

  1. Problem adding cordova plugin after build
    By martskins in forum Sencha Touch 2.x: Q&A
    Replies: 3
    Last Post: 11 Aug 2014, 4:43 PM
  2. Error: Cordova is not defined + need help with a SQLite plugin
    By Stealth22 in forum Sencha Touch 2.x: Q&A
    Replies: 3
    Last Post: 6 Dec 2013, 2:58 AM
  3. 2.3 + CMD 4, custom Phonegap/Cordova plugin?
    By hotdp in forum Sencha Touch 2.x: Q&A
    Replies: 19
    Last Post: 10 Oct 2013, 3:19 AM
  4. [FIXED] [2.1]Ext.device.Contacts is not working
    By XASD in forum Sencha Touch 2.x: Bugs
    Replies: 3
    Last Post: 18 Jan 2013, 3:44 PM

Tags for this Thread