PDA

View Full Version : Getting card indexes on Container.onActiveItemChange()



estesbubba
31 Jan 2012, 2:28 PM
After a lot of experimenting I got it to work but not confident this is the best way to do it. What I want to do is when navigating back remove the old card on my NavigationView (I'm not using the built in Back button). Here is what I came up with but wondering if there is a better/safer way?



onActiveItemChange: function(container, value, oldValue, opts) {
var me = this,
newIdx = Ext.Array.indexOf(value.parent.getInnerItems(), value),
oldIdx = Ext.Array.indexOf(value.parent.getInnerItems(), oldValue);


if (newIdx < oldIdx) {
me.remove(oldValue);
}
}

mitchellsimoens
1 Feb 2012, 9:04 AM
Should be just fine.