PDA

View Full Version : GridPanel has no method getItemId



alfa19
12 Apr 2013, 6:29 AM
Hi everyone,

i'm building an app using architect. I've create a class

Custom.view.MyGridPanel

that extend Ext.grid.Panel. After in my controller i create an object like this:


var grid = { xtype: 'mygridpanel',
id: 'gridpanel1',
title: 'My Grid Panel'
};

and i add this to a tab panel in this way:


tabpanel.add(grid);
tabpanel.setActiveTab(grid);

Ok the insertion works fine and i can see my grid completely working, but the call to setActiveTab give an error: Uncaught TypeError: Object #<Object> has no method 'getItemId'

And obviously the panel don't became active.

So why this happen?

Thanks a lot

slemmon
13 Apr 2013, 9:19 PM
The add method will return the component (or array of components) added. You should pass that to the setActiveTab method instead of 'grid'. 'Grid' is a reference to the javascript object you used to configure the new tab, but isn't the tab component itself.

Try:


var added = tabpanel.add(grid);
tabpanel.setActiveTab(added);