PDA

View Full Version : .setBadge()



Simonhayre
20 Jul 2010, 12:10 AM
well I can't get it working.

I'm using




demos.BottomTabs = new Ext.TabPanel({
tabBar: {
dock: 'bottom',
ui: 'light',
layout: {
pack: 'center'
}
},
ui: 'light',
animation: {
type: 'slide',
cover: true
},
defaults: {
scroll: 'vertical',
},
items: [{
title: 'About',
html: '<p>Docking tabs to the bottom will automatically change their style. The tabs below are ui="light", though the standard type is dark. Badges (like the 4 below) can be added by setting <code>badgeText</code> when creating a tab/card or by using <code>setBadge()</code> on the tab later.</p>',
iconCls: 'info',
cls: 'card card1'
},
{
title: 'Favorites',
html: 'Favorites Card',
iconCls: 'favorites',
cls: 'card card2',
id:'FavTabPanel',
badgeText: '4'
}]
});


And then..



Ext.getCmp('FavTabPanel').setBadge('Hello');


I get the following error message:
TypeError: Result of expression 'Ext.getCmp('FavTabPanel').setBadge' [undefined] is not a function.
:((


I'm using 0.91 ext-touch-debug.js

evant
20 Jul 2010, 12:21 AM
Ext.setup({
icon: 'icon.png',
tabletStartupScreen: 'tablet_startup.png',
phoneStartupScreen: 'phone_startup.png',
glossOnIcon: false,
onReady: function() {
var tabpanel = new Ext.TabPanel({
tabBar: {
dock: 'bottom',
layout: {
pack: 'center'
}
},
fullscreen: true,
ui: 'light',
animation: {
type: 'slide',
cover: true
},
defaults: {
scroll: 'vertical'
},
items: [{
title: 'About',
html: '<h1>Bottom Tabs</h1><p>Docking tabs to the bottom will automatically change their style. The tabs below are type="light", though the standard type is dark. Badges (like the 4 &amp; Long title below) can be added by setting <code>badgeText</code> when creating a tab/card or by using <code>setBadge()</code> on the tab later.</p>',
iconCls: 'info',
cls: 'card1'
}, {
title: 'Favorites',
html: '<h1>Favorites Card</h1>',
iconCls: 'favorites',
cls: 'card2',
badgeText: '4',
id: 'foo'
}, {
title: 'Downloads',
id: 'tab3',
html: '<h1>Downloads Card</h1>',
badgeText: 'Text can go here too, but it will be cut off if it is too long.',
cls: 'card3',
iconCls: 'download'
}, {
title: 'Settings',
html: '<h1>Settings Card</h1>',
cls: 'card4',
iconCls: 'settings'
}, {
title: 'User',
html: '<h1>User Card</h1>',
cls: 'card5',
iconCls: 'user'
}]
});
(function(){
tabpanel.tabBar.items.itemAt(1).setBadge('Foo');
}).defer(2000);
}
});

jeongman
28 Mar 2011, 1:51 PM
Thank you! :D