View Full Version : Question on plugins

7 Oct 2010, 9:14 AM
I'm trying to do tab scroller menu with Ext Designer using Jay's example from: http://tdg-i.com/59/how-to-add-a-tab-scroller-menu

In Jay's example, there's some code which looks like:

items : {
xtype : 'tabpanel',
activeTab : 0,
id : 'myTPanel',
enableTabScroll : true,
resizeTabs : true,
minTabWidth : 75,
plugins : [ scrollerMenu ],
items : [
title : 'our first tab'

Since I cannot set the "plugins" in Ext Designer, then I wanted to work around by writing some code like this:

var scrollerMenu = new Ext.plugins.TDGi.tabScrollerMenu({
maxText : 15,
pageSize : 5

this.tabs.plugins = [ scrollerMenu ];
this.tabs is where my autoRef points to. But seems it does not work.

I'm quite new to Extjs and even OO javascript. Any help would be greatly appreciated!

7 Oct 2010, 9:40 AM
Hi elgs,

You can see this thread post for the answer: http://www.sencha.com/forum/showthread.php?103520-Add-plugin&p=485440#post485440 You are very close, you simply need to call initPlugin on the plugin instance so the tabs instance will realize it has the plugin.

this.tabs.plugins = [ this.tabs.initPlugin(scrollerMenu) ];

Hope that helps!

7 Oct 2010, 10:02 AM
Hi Jarrednicholls,

You rock!! Your code works like a charm! Thanks a lot. The forum is really useful for newbies like me!

Best regards,