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.

Hybrid View

  1. #1
    Touch Premium Member BostonMerlin's Avatar
    Join Date
    Aug 2010
    Location
    Boston
    Posts
    512
    Answers
    20
    Vote Rating
    41
    BostonMerlin has a spectacular aura about BostonMerlin has a spectacular aura about BostonMerlin has a spectacular aura about

      0  

    Default Unanswered: pass a function reference

    Unanswered: pass a function reference


    I've created a controller function that loads data from the server. When the ajax call is complete, I want to call another function that is not known at design time. I assume there is a way to pass a callbackFunction reference into the loadData function to be called once complete. Depending on the state of my app, I may want to call any number of functions but I don't want to hardcode anything in the ajax success event other than calling the passed in function reference.

    Best practice, thoughts, direction?

    Thanks in advance,
    John

  2. #2
    Touch Premium Member BostonMerlin's Avatar
    Join Date
    Aug 2010
    Location
    Boston
    Posts
    512
    Answers
    20
    Vote Rating
    41
    BostonMerlin has a spectacular aura about BostonMerlin has a spectacular aura about BostonMerlin has a spectacular aura about

      0  

    Default


    I've gotten this far but am dealing with a scoping issue.

    Pseudocode... ignore syntax specifics:

    In controller [Main] I do something like this:

    Code:
    var callBack = this.ShowView;
    this.getApplication().getController('Project').LoadProjects(callBack);
    In controller [Project] I do something like this:

    Code:
    LoadProjects: function(callBackF) {
    
    store.load({
       callback: function(records, operation, success){
             callBackF();
    }
    Back in controller [Main] the callback function is executed:

    Code:
    ShowView: function(){
        this.getNavViewRef().show();  //-this errors out
    }

    When the store load is complete, the callBackF() function is called which happens to live back in the [Main] controller. Within that callback function, code errors on the call to a controller reference on that controller this.getNavViewRef();.

    I suspect I need to do something with scope but not sure what specifically and where to apply. Do I need to pass 'this' from [Main] controller to [Project] controller and back to [Main] ? Seems awfully inefficient.

    Thoughts?

    Thanks again in advance,
    John