1. #1
    Sencha User
    Join Date
    Nov 2011
    Posts
    61
    Vote Rating
    0
    aguerra10 is on a distinguished road

      0  

    Default Error when using Sencha in Phonegap notification callback function

    Error when using Sencha in Phonegap notification callback function


    Hi all,

    I am showing a confirm notification using PhoneGap with a callback function that uses some sencha basic code. However when this Sencha code runs, it is sending an error.

    "Error in success callback: com.phonegap.notification0 = TypeError: 'undefined' is not a function"

    This happens when "this.getMainView();" or any of the other lines inside logout method is called.

    However, If I call the logout function without showing the notification, it works.

    Can anybody help me?

    Thanks!!

    Here is the code involved :

    Code:
    init: function() {
         this.setListeners();
    },
    
    setListeners:function(options) {
         this.control({
              '#settingsScreen button[id = logoutButton]': {
                   tap: this.showLogout,
              },
         });
    },
    
    showLogout: function() {
         navigator.notification.confirm('Are you sure you want to logout?', this.onConfirm, 'Logout?', 'No,Yes'); 
    
    },
    
    logout: function() {
            
         var mainView = this.getMainView();
         var mainController = this.getController('MainController');
         var launchscreen = this.getLaunchscreen();
         mainController.setAnimationForward(mainView);
            
         mainView.setActiveItem(launchscreen);
         window.location.href = window.location.href;
            
        },
    
    onConfirm: function(buttonIndex) {
         if (buttonIndex === 2) {          this.logout();
         }
    },

  2. #2
    Sencha - Sencha Touch Dev Team rdougan's Avatar
    Join Date
    Oct 2008
    Posts
    1,158
    Vote Rating
    6
    rdougan will become famous soon enough

      0  

    Default


    Are you sure it is even getting to logout? It looks like it could be a scope issue to me. I experienced this before.

    Code:
    showLogout: function() {
        var me = this,
            fn;
        
        fn = function() {
            me.onConfirm();
        };
    
        navigator.notification.confirm('Are you sure you want to logout?', fn, 'Logout?', 'No,Yes');
    }
    Sencha Inc.
    Robert Dougan - @rdougan
    Sencha Touch 2 and Ext JS 4 Core Team Member, SASS/Theming Wizard.

  3. #3
    Sencha User
    Join Date
    Nov 2011
    Posts
    61
    Vote Rating
    0
    aguerra10 is on a distinguished road

      0  

    Default


    That did the trick!!

    I am new here in the forum and I really appreciate the help I've received so far.

    Thank you rdougan!!

Thread Participants: 1

Turkiyenin en sevilen filmlerinin yer aldigi xnxx internet sitemiz olan ve porn sex tarzi bir site olan mobil porno izle sitemiz gercekten dillere destan bir durumda herkesin sevdigi bir site olarak tarihe gececege benziyor. Sitenin en belirgin ozelliklerinden birisi de Turkiyede gercekten kaliteli ve muntazam, duzenli porno izle siteleri olmamasidir. Bu yuzden iste. Ayrica en net goruntu kalitesine sahip adresinde yayinlanmaktadir. Mesela diğer sitelerimizden bahsedecek olursak, en iyi hd porno video arşivine sahip bir siteyiz. "The Best anal porn videos and slut anus, big asses movies set..." hd porno faketaxi