diff --git a/Navigation.js b/Navigation.js index 69a6baa..d3832b7 100644 --- a/Navigation.js +++ b/Navigation.js @@ -79,7 +79,7 @@ Ext.define('Mba.ux.Viewport.Navigation', { view = Ext.Viewport.add({xtype: viewXtype}); } - if(!animation && view.getAnimation) { + if(!animation && Ext.isFunction(view.getAnimation)) { animation = view.getAnimation(); animation.direction = 'left'; } @@ -138,7 +138,7 @@ Ext.define('Mba.ux.Viewport.Navigation', { */ back: function() { var stack = this.getNavigationStack(), - xtype, animation; + view, xtype, animation; this.clearAutoNavigation(stack[stack.length-1]); @@ -146,7 +146,15 @@ Ext.define('Mba.ux.Viewport.Navigation', { return false; } - animation = this.getAnimation(stack.pop()); + xtype = stack.pop(); + view = Ext.Viewport.child(xtype); + + if (!view.isInnerItem()) { + view.hide(); + return true; + } + + animation = this.getAnimation(view); if (animation) { animation.direction = 'right'; @@ -184,8 +192,10 @@ Ext.define('Mba.ux.Viewport.Navigation', { * @param {xtype} viewXtype * @returns {Object} */ - getAnimation: function(viewXtype) { - var view = Ext.Viewport.child(viewXtype); + getAnimation: function(view) { + if (typeof view === 'string') { + view = Ext.Viewport.child(viewXtype); + } return view.getAnimation ? view.getAnimation() : null; }, diff --git a/viewport/Default.js b/viewport/Default.js index 899a38c..b3604da 100644 --- a/viewport/Default.js +++ b/viewport/Default.js @@ -83,6 +83,19 @@ Ext.define('Mba.ux.viewport.Default', { } }, + /** + * @inheritdoc + */ + add: function() { + var item = this.callOverridden(arguments); + + if (!item.isInnerItem()) { + this.getNavigation().orderHistory(item.xtype); + } + + return item; + }, + /** * @private */