-
6 Jan 2012 5:39 AM #1
Answered: List is not showing inside of a TabPanel
Answered: List is not showing inside of a TabPanel
Hi,
I'm trying to show a list inside of a tab in TabPanel. When I just show the list - it works fine, but when I put it inside of a TabPanel it is not shown.
It is shown when I use this code in the launch event:
And when I use this code, it won't show (though the tabs are shown as need). I've also tried including the Ext.create list inside the items, still same result.Code:Ext.create('Ext.List', { fullscreen: true, itemTpl: '<div class="contact">{ID} <strong>{Name}</strong></div>', store: cityStore });
What could be wrong? Thanks!Code:Ext.create('Ext.TabPanel',{ fullscreen: true, tabBarPosition: 'bottom', scrollable: true, items: [ { title: 'Home', iconCls: 'home', html: ['Welcome to my Pizza!'].join(""), style: 'text-align: center;' }, { title: 'Search', iconCls: 'search', items: [list] // this is Ext.create('Ext.List', { ... as shown before }, { xtype: 'toolbar', title: 'Pizza', dock: 'top' } ] }).setActiveItem(1); // this is set for debugging only
-
Best Answer Posted by mitchellsimoens
You are nesting the list within a panel. Try to unnest it:
Code:Ext.create('Ext.tab.Panel',{ fullscreen: true, tabBarPosition: 'bottom', scrollable: true, items: [ { title: 'Home', iconCls: 'home', html: ['Welcome to my Pizza!'].join(""), style: 'text-align: center;' }, { xtype: 'list', title: 'Search', iconCls: 'search', store: cityStore, itemTpl: '<div class="contact">{ID} <strong>{Name}</strong></div>' }, { xtype: 'toolbar', title: 'Pizza', dock: 'top' } ] }).setActiveItem(1);
-
6 Jan 2012 7:35 AM #2Sencha - Senior Forum Manager
- Join Date
- Mar 2007
- Location
- St. Louis, MO
- Posts
- 33,581
- Vote Rating
- 433
- Answers
- 3100
You are nesting the list within a panel. Try to unnest it:
Code:Ext.create('Ext.tab.Panel',{ fullscreen: true, tabBarPosition: 'bottom', scrollable: true, items: [ { title: 'Home', iconCls: 'home', html: ['Welcome to my Pizza!'].join(""), style: 'text-align: center;' }, { xtype: 'list', title: 'Search', iconCls: 'search', store: cityStore, itemTpl: '<div class="contact">{ID} <strong>{Name}</strong></div>' }, { xtype: 'toolbar', title: 'Pizza', dock: 'top' } ] }).setActiveItem(1);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.
-
6 Jan 2012 7:46 AM #3
Thanks!
Thanks!
You've solved hours on hours of agony

Though I didn't get why this happens.
-
6 Jan 2012 7:49 AM #4Sencha - Senior Forum Manager
- Join Date
- Mar 2007
- Location
- St. Louis, MO
- Posts
- 33,581
- Vote Rating
- 433
- Answers
- 3100
The issue is that the list needs a layout so the size is something more than zero. So with your code when you had it nested within a panel, that panel was using the default 'auto' layout which won't give your list a height therefor you couldn't see it. It was rendered, just with zero height. Tab panel uses card layout which makes each of it's items take up 100% of it's height and width and that is why you can now see it.
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