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.
  1. #1
    Sencha User evgenspb's Avatar
    Join Date
    Jun 2010
    Location
    Russia Saint-Petersburg
    Posts
    30
    Vote Rating
    0
    evgenspb is on a distinguished road

      0  

    Default 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)

    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'
                    }
                }]
            });        
        });
    failing test case:

    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

  2. #2
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    St. Louis, MO
    Posts
    33,582
    Vote Rating
    433
    mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of

      0  

    Default


    Thanks for the report! I have opened a bug in our bug tracker.

  3. #3
    Sencha - Ext JS Dev Team evant's Avatar
    Join Date
    Apr 2007
    Location
    Sydney, Australia
    Posts
    15,066
    Vote Rating
    96
    evant is a splendid one to behold evant is a splendid one to behold evant is a splendid one to behold evant is a splendid one to behold evant is a splendid one to behold evant is a splendid one to behold evant is a splendid one to behold

      0  

    Default


    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!

  4. #4
    Sencha User evgenspb's Avatar
    Join Date
    Jun 2010
    Location
    Russia Saint-Petersburg
    Posts
    30
    Vote Rating
    0
    evgenspb is on a distinguished road

      0  

    Default


    It would be nice to include this information in documentation ;-)
    Something like

    Use only panel with accordion!!!

Tags for this Thread