You found a bug! We've classified it as TOUCH-4479 . We encourage you to continue the discussion and to find an acceptable workaround while we work on a permanent fix.
  1. #1
    Sencha User nak1's Avatar
    Join Date
    Jan 2008
    Posts
    260
    Vote Rating
    0
    nak1 is an unknown quantity at this point

      0  

    Default Ext.app.History.back and Ext.app.Application.redirectTo

    Ext.app.History.back and Ext.app.Application.redirectTo


    Not sure this is a bug, however, I thought that I'd mention it in case it indeed is an issue.

    I was using the back method of the Ext.app.History object when I noticed it wasn't functioning properly in a few use cases. After looking at the code I noticed the following in the back method

    Code:
    previousAction.getController().getApplication().redirectTo(previousAction.getUrl());
    As it's calling redirectTo this is in turn calling dispatch, however, the 'addToHistory' parameter should be passed in as false in the dispatch, because you're going 'back' in the stack, so you don't want to add new items. That said I created two overrides:

    Code:
    //Fix history 'back' issue in which a new action was being created when the 'back' processes was fired
    		Ext.define('Ux.app.History',{
    			override:'Ext.app.History',
    			//Add 'false' to the call to redirect so that it doesn't add a new action element. 
    		    back: function() {
    		        var actions = this.getActions(),
    		            previousAction = actions[actions.length - 2];
    		
    		        if (previousAction) {
    		            actions.pop();
    					previousAction.getController().getApplication().redirectTo(previousAction.getUrl(),false);
    		        }
    		        else {
    		            actions[actions.length - 1].getController().getApplication().redirectTo('');
    		        }
    		    }
    		})
    		//Fix history 'back' issue in which a new action was being created when the 'back' processes was fired
    		Ext.define('Ux.app.Application',{
    			override:'Ext.app.Application',
    			//Add the additional 'addToHistory' parameter so it can be passed into the dispatch call. 
    		     redirectTo: function(url,addToHistory) {
    		        if (Ext.data && Ext.data.Model && url instanceof Ext.data.Model) {
    		            var record = url;
    		
    		            url = record.toUrl();
    		        }
    		
    		        var decoded = this.getRouter().recognize(url);
    		
    		        if (decoded) {
    		            decoded.url = url;
    		            if (record) {
    		                decoded.data = {};
    		                decoded.data.record = record;
    		            }
    		            return this.dispatch(decoded,addToHistory);
    		        }
    		    }
    		})
    No longer a Newbie

  2. #2
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    35,672
    Vote Rating
    748
    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

      0  

    Default


    Thanks for the report! I have opened a bug in our bug tracker.

Thread Participants: 1

film izle

hd film izle

film sitesi

takipci kazanma sitesi

takipci kazanma sitesi

güzel olan herşey

takipci alma sitesi

komik eğlenceli videolar