简体   繁体   English

ExtJs手风琴布局崩溃

[英]ExtJs Accordion Layout Collapse

I have created an accordion layout and added a few panels as shown to it. 我创建了一个手风琴布局,并添加了一些面板,如图所示。 It is working fine. 一切正常。

var changePasswordDlg = new MaPPE.changePasswordDlg();
var lostPasswordDlg = new MaPPE.lostPasswordDlg();
var personalInfoDlg = new MaPPE.personalInfoDlg();
var selectLangDlg = new MaPPE.selectLangDlg();
var visibilityDlg = new MaPPE.visibilityDlg();

var config = {
    layout: 'accordion',
    title: '',
    bodyStyle: 'background-color:#DFE8F6',
    items:[
    changePasswordDlg,
    lostPasswordDlg,
    personalInfoDlg,
    selectLangDlg,
    visibilityDlg
    ]
};

Each dialog is a panel and has a cancel button. 每个对话框都是一个面板,并具有一个取消按钮。 I want the cancel button of each panel to collapse the current panel from the accordion layout. 我希望每个面板的“取消”按钮从手风琴布局中折叠当前面板。 How can this be done? 如何才能做到这一点?

I have tried searching for it and found that setting expand to false does the trick. 我尝试搜索它,发现将设置expand为false可以解决问题。 But I couldn't find on which component to call the expand function. 但是我找不到在哪个组件上调用expand函数。

Depending on the layout of the panels, the cancel buttons should be able to do something like: 根据面板的布局,“取消”按钮应该能够执行以下操作:

this.ownerCt.expand();

However, that gets complex and fragile if you are changing layouts around. 但是,如果您要更改布局,则会变得复杂而脆弱。 Better to set the panel as a property in the cancel button's config and use it within the button's handler: 最好在“取消”按钮的配置中将面板设置为属性,并在按钮的处理程序中使用它:

var cancelButton = new Ext.Button({other: 1, config: 2, items:3, mySettingsDialog: this}); 
// where this is a reference to the encompassing dialog panel

Then in the handler: 然后在处理程序中:

this.mySettingsDialog.expand();

The scope for the handler defaults to the Button unless you've changed it. 除非已更改,否则处理程序的作用域默认为Button。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM