View Full Version : How could I add the tab form the xtype:viewport example

26 Nov 2013, 2:25 PM
Dear all,
Sorry for I have less experience for ExtJs even JS , but my boss ask me to build the page with it,

I have created the page with the following code example from Sencha documention (http://docs.sencha.com/extjs/4.2.2/#!/api/Ext.container.Viewport)

does someone could provide me the function to add the tab in the center part,

I've try a lot of way and have no idea to get the object of it and add the more items with it
, thanks a lot :)

Ext.create (http://docs.sencha.com/extjs/4.2.2/#%21/api/Ext-method-create)('Ext.container.Viewport (http://docs.sencha.com/extjs/4.2.2/#%21/api/Ext.container.Viewport)', {
layout: 'border',
items: [{
region: 'north',
html: '<h1 class="x-panel-header">Page Title</h1>',
border: false,
margins: '0 0 5 0'
}, {
region: 'west',
collapsible: true,
title: 'Navigation',
width: 150
// could use a TreePanel or AccordionLayout for navigational items
}, {
region: 'south',
title: 'South Panel',
collapsible: true,
html: 'Information goes here',
split: true,
height: 100,
minHeight: 100
}, {
region: 'east',
title: 'East Panel',
collapsible: true,
split: true,
width: 150
}, {
region: 'center',
xtype: 'tabpanel', // TabPanel itself has no title
activeTab: 0, // First tab active by default
items: {
title: 'Default Tab',
html: 'The first tab\'s content. Others may be added dynamically'

as the example , it just created a tab when lunch, I would like to add more tabs after the page established , thanks

Gary Schlosberg
26 Nov 2013, 7:04 PM
Here's an example that should help get you going:

26 Nov 2013, 8:36 PM
Dear Gary,
thanks for reply, I've tried this before ,
but I got the error message : TypeError: Ext.getCmp(...) is undefined

did I miss something ?! thanks :)

26 Nov 2013, 8:39 PM
Gary: Thanks!!!!! I got it!!!! I forgot to add the ID for Items Have a nice day :D