Guide applies to: modern
1.Have the MainView extend TabPanel
Currently, MainView.js
has a simple container as our top level component. By extending the Tab Panel class, the top level container can take advantage of its card layout features, seeing one tab at a time.
Replace the extend: 'Ext.Container'
line with: extend: 'Ext.tab.Panel'
2. Modify the items array
Replace the current items array in MainView.js
with the following html
configs, placeholders for eventual tab objects:
items: [{
title: "Thumbnails",
html: '<h1>tunes view</h1>'
}, {
title: "Grid",
html: '<h1>tunes grid</h1>'
}]
3.Dock the tabs at the bottom
Add the line tabBarPosition: ‘bottom’, above the items array to add the tabs to the bottom of the display.
When you are done, refresh the browser, the results should look like the following:
Thumbnails Tab
Grid Tab
4. This should be the code when you are done:
Ext.define('ModernTunes.view.main.MainView', {
extend: 'Ext.tab.Panel',
xtype: 'mainview',
controller: 'mainviewcontroller',
viewModel: {
type: 'mainviewmodel'
},
tabBarPosition: 'bottom',
items: [{
title: "Thumbnails",
html: '<h1>tunes view</h1'
}, {
title: "Grid",
html: '<h1>tunes grid</h1>'
}]
})
Take note of the +activeItem+ config that specifies which tab displays by default.