如何根据条件在可折叠面板中设置折叠值?-EXTJS

问题描述 投票:0回答:1

我有一个可折叠面板:

$cls.superclass.constructor.call(this, Ext.apply({
        panel = new Ext.Panel({
            title: "Panel",
            collapsed: true,
            items: [
                this.section({
                    items: [
                        this.filter = new Ext.form.DisplayField({})
                    ]
                })
            ],

            collapsible: true,
        })
    });

    Ext.extend($cls, frame.mono.dialog.ObjectPanel, {

            afterRender: function(rule) {
                $cls.superclass.afterRender.apply(this, arguments);
                //depending on some condition I'm trying to change the value of collapsed to false
                //if (//some condition) {
                this.panel.collapsed = false;
                this.panel.doLayout(); // this is not working
            }

        }
    });

如何根据条件在可折叠面板中设置折叠值?

javascript extjs
1个回答
0
投票

你可以使用toggleCollapse方法来实现你想要做的事情。在prerender活动中进行。

请参考以下小提琴 -

https://fiddle.sencha.com/#view/editor&fiddle/2kvv

© www.soinside.com 2019 - 2024. All rights reserved.