Gelmiş geçmiş en büyük porno sitemiz olan 2pe de her zaman en kaliteli pornoları sunmayı hedefledik. Diğer video sitemiz olan vuam da ise hd porno ağırlıklı çalışmalara başladık.

  1. #1
    Sencha User
    Join Date
    Jul 2011
    Posts
    18
    Vote Rating
    0
    tvance929 is on a distinguished road

      0  

    Default Answered: Set textfield value outside of the config area in a callback function ?

    Answered: Set textfield value outside of the config area in a callback function ?


    I'm trying to learn how to make PhoneGap and Sencha work together. (I'm a little new to both however).

    So in a controller on a button click I fire off a phonegap function that calls for a callback function on success (which delivers the compass direction).

    This works fine. (at least when I alert the compass reading).

    However, I was hoping to set a textfield with the heading. But I cannot figure out how to get to work outside of the config area ... can someone clue me in?

    ** NOTICE THE setValue that sets to NOPE! This works if I uncomment it... I assume because it is inside the config area...but the onSuccess will not set this textfield.

    Code:
    config: {
            refs: {
                homePanel: 'homePanel',
                testText: '#testTextField'
            },
            control: {
                homepanel: {
                    activate: function () {
                        //alert('activate');
                    }
                },
                'button[action=homeExample]': {
                    tap: function () {
                        navigator.compass.getCurrentHeading(this.onSuccess,this.onError);
                        //this.getTestText().setValue('NOPE!');
                    }
                },
                testText: {
                    change: function (field, newValue, oldValue) {
                        //alert(this.getTestText().getValue());
                      
                    }
                }
            }
        },
        
         onSuccess: function (heading) {
            this.getTestText().setValue('Heading: ' + heading.magneticHeading);
        }

  2. Or you can change the scope:

    Code:
    var bind = Ext.bind;
    
    navigator.compass.getCurrentHeading(
        bind(this.onSuccess, this),
        bind(this.onError, this)
    );
    Now in your onSuccess/onError, the scope (this) is that of the controller.

  3. #2
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    36,519
    Answers
    3447
    Vote Rating
    814
    mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute

      1  

    Default


    You have a scoping issue. The onSuccess scope will not automatically be of the controller
    Mitchell Simoens @SenchaMitch
    Sencha Inc, Senior Forum Manager
    ________________
    Check out my GitHub, lots of nice things for Ext JS 4 and Sencha Touch 2
    https://github.com/mitchellsimoens

    Think my support is good? Get more personalized support via a support subscription. https://www.sencha.com/store/

    Need more help with your app? Hire Sencha Services services@sencha.com

    Want to learn Sencha Touch 2? Check out Sencha Touch in Action that is in print!

    When posting code, please use BBCode's CODE tags.

  4. #3
    Sencha User
    Join Date
    Jul 2011
    Posts
    18
    Vote Rating
    0
    tvance929 is on a distinguished road

      0  

    Default


    I was able to change the textbox by using

    Code:
     onSuccess: function (heading) {
         	Ext.getCmp('testTextField').setValue('Heading: ' + heading.magneticHeading);
        }
    Although that works, I'm sure its not the planned pattern.

  5. #4
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    36,519
    Answers
    3447
    Vote Rating
    814
    mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute

      1  

    Default


    Or you can change the scope:

    Code:
    var bind = Ext.bind;
    
    navigator.compass.getCurrentHeading(
        bind(this.onSuccess, this),
        bind(this.onError, this)
    );
    Now in your onSuccess/onError, the scope (this) is that of the controller.
    Mitchell Simoens @SenchaMitch
    Sencha Inc, Senior Forum Manager
    ________________
    Check out my GitHub, lots of nice things for Ext JS 4 and Sencha Touch 2
    https://github.com/mitchellsimoens

    Think my support is good? Get more personalized support via a support subscription. https://www.sencha.com/store/

    Need more help with your app? Hire Sencha Services services@sencha.com

    Want to learn Sencha Touch 2? Check out Sencha Touch in Action that is in print!

    When posting code, please use BBCode's CODE tags.

Thread Participants: 1

Tags for this Thread