-
23 Jan 2013 8:20 AM #1
accordion and dataview problem
accordion and dataview problem
Hello, looks like it is not possible to create dataview object insade accordion
Here is example.
Code does work until I set layout=accordion (red code)
Also, it does work if create empty panel in accordion and create dataview inside that panel. (green code)
failing test case:Code:Ext.onReady(function() { Ext.define('Image', { extend: 'Ext.data.Model', fields: [ { name:'src', type:'string' }, { name:'caption', type:'string' } ] }); Ext.create('Ext.data.Store', { id:'imagesStore', model: 'Image', data: [ { src:'http://www.sencha.com/img/20110215-feat-drawing.png', caption:'Drawing & Charts' }, { src:'http://www.sencha.com/img/20110215-feat-data.png', caption:'Advanced Data' }, { src:'http://www.sencha.com/img/20110215-feat-html5.png', caption:'Overhauled Theme' }, { src:'http://www.sencha.com/img/20110215-feat-perf.png', caption:'Performance Tuned' } ] }); var imageTpl = new Ext.XTemplate( '<tpl for=".">', '<div style="margin-bottom: 10px;" class="thumb-wrap">', '<img src="{src}" />', '<br/><span>{caption}</span>', '</div>', '</tpl>' ); Ext.create('Ext.container.Viewport', { layout: 'border', items: [{ region: 'west', collapsible: true, title: 'View', width: 150, split: true, layout: 'accordion', items:[{ items: { xtype:'dataview', store: Ext.data.StoreManager.lookup('imagesStore'), tpl: imageTpl, itemSelector: 'div.thumb-wrap', emptyText: 'No images available'} }] }, { 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' } }] }); });
Code:Ext.define('Image', { extend : 'Ext.data.Model', fields : [ { name : 'src', type : 'string' }, { name : 'caption', type : 'string' } ] }); Ext.create('Ext.data.Store', { id : 'imagesStore', model : 'Image', data : [ { src : 'http://www.sencha.com/img/20110215-feat-drawing.png', caption : 'Drawing & Charts' }, { src : 'http://www.sencha.com/img/20110215-feat-data.png', caption : 'Advanced Data' }, { src : 'http://www.sencha.com/img/20110215-feat-html5.png', caption : 'Overhauled Theme' }, { src : 'http://www.sencha.com/img/20110215-feat-perf.png', caption : 'Performance Tuned' } ] }); var imageTpl = new Ext.XTemplate( '<tpl for=".">', '<div style="margin-bottom: 10px;" class="thumb-wrap">', '<img src="{src}" />', '<br/><span>{caption}</span>', '</div>', '</tpl>' ); Ext.create('Ext.container.Viewport', { layout : 'border', items : [ { region : 'west', collapsible : true, title : 'View', width : 150, split : true, layout : 'accordion', items : [ { xtype : 'dataview', store : Ext.data.StoreManager.lookup('imagesStore'), tpl : imageTpl, itemSelector : 'div.thumb-wrap', emptyText : 'No images available' } ] }, { 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' } } ] });Last edited by mitchellsimoens; 23 Jan 2013 at 11:08 AM. Reason: added failed test
-
23 Jan 2013 11:08 AM #2Sencha - Senior Forum Manager
- Join Date
- Mar 2007
- Location
- St. Louis, MO
- Posts
- 33,582
- Vote Rating
- 433
Thanks for the report! I have opened a bug in our bug tracker.
-
23 Jan 2013 12:49 PM #3
This is not a bug. Items inside an accordion layout need to be panels because they rely on the panel header being rendered (title, tools).
Evan Trimboli
Sencha Developer
Twitter - @evantrimboli
Don't be afraid of the source code!
-
24 Jan 2013 1:14 AM #4
It would be nice to include this information in documentation ;-)
Something like
Use only panel with accordion!!!
You found a bug! We've classified it as
EXTJSIV-8294
.
We encourage you to continue the discussion and to find an acceptable workaround while we work on a permanent fix.


Reply With Quote