PDA

View Full Version : [FIXED] TabPanel with no items breaks on creation - PR2



vitorgomes
13 Nov 2011, 6:13 PM
In the application we're developing, there is a TabPanel that has no items in the view, so the items can be added dynamically by the controller.

Here's the view code:


Ext.define('BFM.view.Portal', {
extend: 'Ext.TabPanel',
xtype: 'portal',


config: {
fullscreen: true,
scrollable: false,
tabBar : {
itemId: 'navigation',
docked : 'bottom',
layout : { pack : 'center' },
scrollable: {
direction: 'horizontal'
}
}
}
})


It was working well with PR1, however when upgrading to PR2, when I call
this.getPortalView().create();from the controller, it returns the error:

Uncaught TypeError: Object #<Object> has no method 'getAnimation'

The same doesn't happen when I add one single item in the view's config section.

mitchellsimoens
14 Nov 2011, 10:35 AM
Thank you for the report.

Jamie Avins
15 Nov 2011, 9:27 AM
This override should fix the error and the tabs should animate in the proper direction as well:



Ext.override(Ext.tab.Panel, {
doSetActiveItem: function(newActiveItem, oldActiveItem) {
if (newActiveItem) {
var items = this.getInnerItems(),
oldIndex = items.indexOf(oldActiveItem),
newIndex = items.indexOf(newActiveItem),
reverse = oldIndex > newIndex;

this.getLayout().getAnimation().setReverse(reverse);

this.callParent(arguments);

if (newIndex != -1) {
this.getTabBar().setActiveTab(newIndex);
}
}
}
});


This will be part of the next release.

vitorgomes
17 Nov 2011, 2:56 PM
Hi James,
Thanks so much for the override.
It solved the 'getAnimation' error, but animations are not consistent.


- Chrome and Safari (desktop and iPhone simulator): Animations goes from right to left only.
- iOS 5 Simulator with phonegap: works correctly.
- Android with phonegap: the app doesn't even launch with PR2, but that should be another issue.


Cheers
Vitor

Jamie Avins
17 Nov 2011, 4:14 PM
Indeed there is much work to do on Animations and this will be done before a final release. We do feel that those problems have a lower priority to other issues such as missing functionality or critical bugs such as this one.