Dynamic TabBar

I need to create a dynamic tabbar in my app and the way I have tried to do this is have three arrays of items for the tabbar and to switch them dynamically as required.

This works great until I add back one that has already been removed and then I get an error:

Type Error 'undefined' is not an object (a.disabled) in the onTabTap event handler in Ext.TabBar.

The code I am using to do this:

myTabBar.removeAll(true)
for each item in itemsToAdd
myTabBar.add(item)
myTabBar.doComponentLayout()

It looks like maybe the line in onTouchStart which calls onTabTap calls Ext.getCmp(t.id) and is not finding the component once it has been removed and added back - even though I can see it on the screen ok.

If you're still wondering about this, my solution for a similar problem was to create a unique toolbar for each view and letting the view decide what each toolbar had on it in its initialize function. I assume it's different for you since you're using a tabbar, but if you still need help I could go further into detail.

I tried everything I could think of to get it going the way I started with but I got no where.

So earlier today I decided to try a different approach. Its not ideal but it seems ok - I am loading up all the tabs into the tabbar in three sets of five and then when I want to cycle through each set I use hide() to hide the five visible ones and show() on the five in the next set to display them.

I guess this is similar to your suggestion in some ways and thanks very much for replying.