In Sencha Touch 2, I use this code snippet in my controller:
this.control({
'#test_button': {
tap: function () {
var root_c = Ext.getCmp("main_container");
root_c.setActiveItem(
1, {type:'slide', direction: 'left'}
);
}
}
});
It works nicely, but it switches only the “default way”, not the “sliding way”. Can anyone help, why?
Thanks in advance,
R
As the others said, use animateActiveItem. Alternately you can keep your (single parameter) setActiveItem and also set a showAnimation and hidAnimation on the particular view being shown.
Having said that, this has been problematic in my experience if your shown items are nested with a lot of going back and forth.
update
I just discovered that there’s an apparent timing bug in st2.0.1 such that if you use show/hideAnimation, you can’t actually destroy the object that has the attribute set. Bit me hard. Related: http://www.sencha.com/forum/showthread.php?192847-Animating-panels-throws-Cannot-call-method-getPageBox-of-null