Results 1 to 3 of 3
  1.    #1  
    I'm having a problem figuring out how to do the following:

    1) Main page gets data via AJAX to server and shows list on screen
    2) User goes to "Preference" page via App Menu.
    3) User makes changes to settings which makes AJAX calls to server to update database
    4) Preference page does a popScene() to return back to main page

    At this point, the main page list data is old because it needs to be refreshed from the server again. For the life of me, I cannot figure out where to put the code to refresh the list.

    Do I need to put the refresh screen/AJAX routine in the stage-assistant and call it directly from the preference function? I'm not sure I can do that.

    I guess there's something obvious I'm missing here. Help?
  2. drnull's Avatar
    Posts
    570 Posts
    Global Posts
    571 Global Posts
    #2  
    Quote Originally Posted by djpushplay View Post
    I'm having a problem figuring out how to do the following:

    1) Main page gets data via AJAX to server and shows list on screen
    2) User goes to "Preference" page via App Menu.
    3) User makes changes to settings which makes AJAX calls to server to update database
    4) Preference page does a popScene() to return back to main page

    At this point, the main page list data is old because it needs to be refreshed from the server again. For the life of me, I cannot figure out where to put the code to refresh the list.

    Do I need to put the refresh screen/AJAX routine in the stage-assistant and call it directly from the preference function? I'm not sure I can do that.

    I guess there's something obvious I'm missing here. Help?
    popScene takes parameters, and those parameters will show up in the activate method of the parent scene.

    That same activate method is called, of course, the first time you enter the scene, so make sure you account for that entry path as well.
  3.    #3  
    Quote Originally Posted by drnull View Post
    popScene takes parameters, and those parameters will show up in the activate method of the parent scene.

    That same activate method is called, of course, the first time you enter the scene, so make sure you account for that entry path as well.
    OMG! It was so simple, it's not even funny. Really appreciate the quick response. I'll put the code below in case anybody else is interested.

    The code in my preference at the very end below:
    Code:
    this.reload = true;
    this.controller.stageController.popScene(this);	// return to previous screen and reload
    The code in my main page to refresh the data below:
    Code:
    MainAssistant.prototype.activate = function(event) {
    	if ((event === undefined) || (event.reload == false))
    		return;
    		
    	this.refreshList();	// reload data
    }

Posting Permissions