PDA

View Full Version : How to add TabPanel into Viewport



Ex_Soft
16 Jan 2012, 6:21 AM
I've tried:

app.js


Ext.Loader.setConfig({
enabled: true
});

Ext.application({
name: "Test",

appFolder: "app",

controllers: [
"TestTabPanel"
],

launch: function () {
Ext.create("Test.view.Viewport", {
});
}
});


Viewport.js


Ext.define("Test.view.Viewport", {
extend: "Ext.container.Viewport",
layout: "fit",
items: [
{
xtype: "testtabpanel"
}
]
});


TestTabPanel.js


Ext.define("Test.controller.TestTabPanel", {
extend: "Ext.tab.Panel",
alias: "widget.testtabpanel",
items: [
{
title: "Tab# 1"
}, {
title: "Tab# 2"
}
],

init: function () {
},

onLaunch: function () {
}

});

Why should I add empty init and onLaunch?

mitchellsimoens
16 Jan 2012, 10:58 AM
Your Test.controller.TestTabPanel extends Ext.tab.Panel. Your controllers should extend Ext.app.Controller and your views should use the Test.view namespace. Your controllers have to at least have the init method. It looks like you are trying to have a view act as a controller and view which is invalid.