PDA

View Full Version : Dynamic TabBar



uksencha
23 May 2012, 10:28 AM
Hi

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.

Does anyone have any ideas ?

Thanks

Chris

V7Theory
24 May 2012, 2:28 PM
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.

uksencha
24 May 2012, 2:46 PM
Hi V7Theory

Thanks for your reply.

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.

Chris

V7Theory
24 May 2012, 2:52 PM
Good to hear. If it works, doesn't slow anything down and is easy to follow, your job is done :)