PDA

View Full Version : setBadge is not a function.



keif
25 Mar 2011, 7:47 AM
I've googled my heart out and came to a few forum posts that seem to address this:
http://www.sencha.com/forum/showthread.php?103299-Set-badge-text-from-the-scope-of-a-Panel
http://www.sencha.com/forum/showthread.php?119868-Updaing-the-badgeText-property-of-a-panel
http://www.sencha.com/forum/showthread.php?104684-.setBadge()

...except they don't for me.

I can access a panel directly and it's pulling the object:


var carousel = new Ext.Carousel({
badgeText: '16',
id: 'lookbook',
items:....
// 17 items
});

// edit the badge
console.debug(carousel.items.length); // 17
console.debug(carousel.badgeText); // 16

console.debug(Ext.getCmp('lookbook').badgeText); // 16
Ext.getCmp('lookbook').setBadge('20'); // function is undefined

// it's loaded in a panel with a var tabpanel
console.debug(tabpanel.items.items[1]); // carousel object
console.debug(tabpanel.items.items[1].badgeText); // 16
console.debug(tabpanel.items.items[1].badgeText = '20'); // 20
tabpanel.items.getAt(1).setBadge('6'); // undefined function
tabpanel.items.items[1].setBadge('7'); // undefined function
console.debug(tabpanel.items.items[1].badgeText); // 20, but stil shows onscreen as 16


Anyone have any insight? I'm using a modified demo that is the tab panels with the carousel being a tab. Everything else works, no other errors - just on setBadge('anything');

Thanks for any help!

keif
25 Mar 2011, 7:50 AM
Well .

All the googling failures, scouring the results, and after I post, the answer is right below:

http://www.sencha.com/forum/showthread.php?108510-setBadge()-to-a-tab-by-id


tabpanel.tabBar.items.getAt(1).setBadge('whatever'); // works!