Results 1 to 7 of 7

Thread: [RC1] Ext.app.History#back not working

    Success! Looks like we've fixed this one. According to our records the fix was applied for TOUCH-2278 in a recent build.
  1. #1
    Ext JS Premium Member Steffen Hiller's Avatar
    Join Date
    Mar 2008
    Posts
    786
    Vote Rating
    36
      0  

    Default [RC1] Ext.app.History#back not working

    My first request would be to make the 'back' method public, since I find it very useful.

    Secondly, it's not trying to do the right thing and it's not working, see:
    Code:
        back: function() {
            this.getActions().pop().run();
        },
    It tries to run the last action, but it should run the previous action.
    Then, the 'run' method doesn't exist anymore, should be 'execute'.
    But this still doesn't change the URL, see below:


    Here's my override for now. All my controller actions use URLs, but it could be made smarter to work for actions without URLs.
    Code:
    Ext.define('MyApp.override.app.History', {
        override : 'Ext.app.History',
        
        back: function() {
            var actions = this.getActions(),
                previousAction = actions[actions.length - 2],
                app = previousAction.getController().getApplication();
            
            actions.pop();
            
            app.redirectTo(previousAction.getUrl());
        }
        
    });

  2. #2
    Sencha - Sr Software Engineer mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    39,553
    Vote Rating
    1272
      0  

    Default

    We will take a look at it!
    Mitchell Simoens @LikelyMitch
    Sencha Inc, Senior Software Engineer
    ________________
    Learn BBCode and use it! Checkout the CODE tag!

    Check out my GitHub, lots of nice things for Ext JS and Sencha Touch
    https://github.com/mitchellsimoens

  3. #3
    Sencha User
    Join Date
    Jun 2009
    Posts
    47
    Vote Rating
    0
      0  

    Default

    We're just coming along the same problem in touch 2.0.0 and the bug is not fixed yet. Seems like the same is true for the current 2.0.1.1 release. Are there any efforts to fix this issue?

    Additionally there's also a general conceptional problem with the app history. The behaviour is not really as expected on android devices using the native back button. The browser history is stepping back while the app history does not recognize the uri change and popping the last action from the stack. So when I navigate into some views and my history will not represent the current state when step backwards. The same is true for the browser built-in history.back and history.go(-X) methods.
    In conjunction with the NavigationView that's a huge pain. All this circumstances render the app history pretty useless.

  4. #4
    Ext JS Premium Member SimonFlack's Avatar
    Join Date
    Jul 2010
    Location
    Norway
    Posts
    242
    Vote Rating
    3
      0  

    Default

    Same problems here. Had to write my own back() function based on Steffens and handle empty actions array (I.e when navigating back to home view)

    Code:
    back: function() {
                    var app = myApp.app,
                          previousAction = app._history._actions[app._history._actions.length-2];
                         
                    if(previousAction){
                        app._history._actions.pop();
                        app._history._actions.pop();
                        app.redirectTo(previousAction._url);           
                    }else{
                        app._history._actions = [];
                        app.showHome();
                    }
                }
    Figured I would post this just incase others are having problems.
    Simon Flack
    CEO and UX Designer
    WhiteFox AS, Norway

    Web: www.whitefox.no

    Facebook: www.facebook.com/WhiteFoxAS

    Twitter: @WhiteFoxAS

  5. #5
    Sencha User
    Join Date
    Mar 2007
    Location
    Haarlem, Netherlands
    Posts
    1,243
    Vote Rating
    11
      0  

    Default

    I have incorporated Steffen's patch into the next release. Thanks for the report and fix.

  6. #6
    Sencha Premium Member
    Join Date
    Mar 2011
    Posts
    9
    Vote Rating
    0
      0  

    Default It seems like this is still broken in ST 2.1

    Because the stack is only popped once, if you attempt to go back twice, it throws you into an infinite back loop of staying on the same page.

    If you pop the stack twice, everything works as expected.

  7. #7
    Sencha User
    Join Date
    Dec 2012
    Posts
    13
    Vote Rating
    0
      0  

    Default Still not working in Touch 2.3

    It's a pity that even such simple things get not fixed properly, 1 year and half and several releases of the software after the problem was reported.

    Anyway, my simple solution is to implement a new back() function on the application instance that basically does

    Code:
    var history = this.getHistory();
    
    history.back();
    
    var actions = history.getActions();
    actions.pop();
    hth, ciao, lele.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •