-
30 Aug 2012 6:00 AM #1
Answered: Incredibly simple toolbar config question
Answered: Incredibly simple toolbar config question
I am building a test app with sencha touch 2.
For some reason, I cannot add a tab panel as an item to a global container added to the viewport. My app.js file initializes the viewport, adds the 'Main.js' view to it. Here is the source code that works, slightly (see the bottom, sorry for horrid indenting).
Ext.define('Test.view.Main',{
extend: 'Ext.Container',
requires: [
'Test.view.Home',
'Test.view.MyTabView'
],
fullscreen: true,
config: {
items: [
{
xtype: 'mytabview'
}
]
}
});
This at least initializes the the tab view properly, which is stored in a seperate view file, Test.view.MyTabView. (source below)
Ext.define('Test.view.MyTabView',{
extend: 'Ext.TabPanel',
fullscreen: true,
xtype: 'mytabview',
requires: 'Test.view.Home',
config: {
defaults: {
styleHtmlContent: true
},
tabBarPosition: 'bottom',
docked: 'bottom',
items: [
{
xtype: 'homepanel'
}
]
}
});
But when i combine the two, inline, nothing works anymore. Of course i could and should keep it in a separate file for better organization, but it is important to my understanding of the framework itself as to why this isnt working. (source below).
Ext.define('Test.view.Main',{
extend: 'Ext.Container',
requires: [
'Test.view.Home',
'Test.view.MyTabView'
],
fullscreen: true,
config: {
items: [
{
fullscreen: true,
xtype: 'mytabview',
requires: 'Test.view.Home',
config: {
defaults: {
styleHtmlContent: true
},
tabBarPosition: 'bottom',
docked: 'bottom',
items: [
{
xtype: 'homepanel'
}
]
}
}
]
}
});
NOTE: Neither of these implementations also correctly render the HTML inside the provided tab objects into the viewport. homepanel is an xtype of a Panel defined in Test.view.Home, but even defining an inline panel doesnt work.
javascript sencha sencha-touch-2 javascript-objects
-
Best Answer Posted by mitchellsimoens
Something more like this:
Although looking at this class, it's overnesting. Since Test.view.Main only has a single item (the mytabview) you then don't need the Test.view.Main class.Code:Ext.define('Test.view.Main', { extend : 'Ext.Container', requires : [ 'Test.view.Home', 'Test.view.MyTabView' ], config : { layout : 'fit', items : [ { xtype : 'mytabview', defaults : { styleHtmlContent : true }, tabBarPosition : 'bottom', items : [ { xtype : 'homepanel' } ] } ] } });
-
1 Sep 2012 6:47 AM #2Sencha - Senior Forum Manager
- Join Date
- Mar 2007
- Location
- St. Louis, MO
- Posts
- 33,582
- Vote Rating
- 433
- Answers
- 3101
2 things, remove the fullscreen configs. Also, child items shouldn't use the config object, have the configs outside of the config object for the mytabview item config (also remove the requires property)
Mitchell Simoens @SenchaMitch
Sencha Inc, Senior Forum Manager
________________
http://www.JSONPLint.com - Source to lint your JSONP!
Check out my GitHub, lots of nice things for Ext JS 4 and Sencha Touch 2
https://github.com/mitchellsimoens
Think my support is good? Get more personalized support via a support subscription. https://www.sencha.com/store/
Need more help with your app? Hire Sencha Services services@sencha.com
Want to learn Sencha Touch 2? Check out Sencha Touch in Action that is almost in print!
When posting code, please use BBCode's CODE tags.
-
1 Sep 2012 11:54 AM #3
-
2 Sep 2012 9:36 AM #4Sencha - Senior Forum Manager
- Join Date
- Mar 2007
- Location
- St. Louis, MO
- Posts
- 33,582
- Vote Rating
- 433
- Answers
- 3101
Something more like this:
Although looking at this class, it's overnesting. Since Test.view.Main only has a single item (the mytabview) you then don't need the Test.view.Main class.Code:Ext.define('Test.view.Main', { extend : 'Ext.Container', requires : [ 'Test.view.Home', 'Test.view.MyTabView' ], config : { layout : 'fit', items : [ { xtype : 'mytabview', defaults : { styleHtmlContent : true }, tabBarPosition : 'bottom', items : [ { xtype : 'homepanel' } ] } ] } });Mitchell Simoens @SenchaMitch
Sencha Inc, Senior Forum Manager
________________
http://www.JSONPLint.com - Source to lint your JSONP!
Check out my GitHub, lots of nice things for Ext JS 4 and Sencha Touch 2
https://github.com/mitchellsimoens
Think my support is good? Get more personalized support via a support subscription. https://www.sencha.com/store/
Need more help with your app? Hire Sencha Services services@sencha.com
Want to learn Sencha Touch 2? Check out Sencha Touch in Action that is almost in print!
When posting code, please use BBCode's CODE tags.


Reply With Quote