手风琴布局混乱

时间:2012-11-09 02:56:14

标签: extjs4.1

我正在使用一套有手风琴的小组说第一个孩子,第二个孩子,第三个孩子。

我发现小组已经实例化了第一个孩子

会自动扩展。但是当我删除第一个孩子时,Accordion布局面板无法自动展开孩子。

抱歉我的英语不好,表达不清楚,有人可以帮忙解决问题吗

var firstChild ={
        id:'first',
        title: 'first child',
        html: 'first child'
    };


var acc=    Ext.create('Ext.panel.Panel', {
    title: 'Accordion layout',
    width: 300,
    height: 300,
    layout:'accordion',
    defaults: {
        bodyStyle: 'padding:15px'
    },
    layoutConfig: {
        titleCollapse: false,
        animate: false,
        activeOnTop: true,
        collapseFirst:true
    },
    items: [
        firstChild,
        {
        title: 'second child',
        html: 'second child'
    },{
        title: 'third child',
        html: 'third child'
    }],
    renderTo: 'demo'
});


acc.remove(Ext.getCmp("first"));
删除第一个孩子后,不能自动扩展孩子

新用户不允许发布图片,这里是地址

http://i.stack.imgur.com/im848.jpg  http://i.stack.imgur.com/E1ze7.jpg

2 个答案:

答案 0 :(得分:0)

你可以告诉它扩展:

Ext.onReady(function() {

    var acc = Ext.create('Ext.panel.Panel', {
        title: 'Accordion layout',
        width: 300,
        height: 300,
        layout: 'accordion',
        defaults: {
            bodyStyle: 'padding:15px'
        },
        layoutConfig: {
            titleCollapse: false,
            animate: false,
            activeOnTop: true,
            collapseFirst: true
        },
        items: [{
            id: 'first',
            title: 'first child',
            html: 'first child'
        }, {
            title: 'second child',
            html: 'second child'
        }, {
            title: 'third child',
            html: 'third child'
        }],
        renderTo: document.body
    });

    acc.remove('first');
    acc.items.first().expand();

});

答案 1 :(得分:0)