在extjs中崩溃时面板隐藏

时间:2012-06-05 09:41:10

标签: forms extjs panel

我试着解释我的问题。我有一个标签面板。在一个标签中,我有一个表格面板和一个网格面板,两者都可以折叠。当我折叠表单面板时,它将崩溃,当我折叠网格面板时,它们都会折叠。现在当我解开两个面板中的一个时,另一个面板消失了。这可能是什么?

Ext.define('MyApp.view.TMS', {
    extend: 'Ext.container.Viewport',

    id: 'tmsViewport',
    layout: {
        type: 'border'
    },

    initComponent: function () {
        var me = this;

        Ext.applyIf(me, {
            items: [{
                xtype: 'tabpanel',
                id: 'mainTab',
                activeTab: 0,
                region: 'center',
                items: [{
                    xtype: 'panel',
                    id: 'configurationTab',
                    title: 'Configuration',
                    items: [{
                        xtype: 'tabpanel',
                        id: 'configurationVehicles',
                        title: 'configuration',
                        activeTab: 0,
                        items: [{
                            xtype: 'panel',
                            id: 'configurationDrivers',
                            collapsed: false,
                            title: 'Drivers',
                            items: [{
                                xtype: 'form',
                                floating: false,
                                height: 400,
                                id: 'configurationDriversConfiguration',
                                itemId: 'configurationDriversConfiguration',
                                bodyPadding: 10,
                                animCollapse: false,
                                collapsed: false,
                                collapsible: true,
                                title: 'Driver Configuration',
                                items: [{
                                    xtype: 'button',
                                    id: 'configurationDriversAdd',
                                    text: 'Add'
                                }, {
                                    xtype: 'button',
                                    id: 'configurationDriversDelete',
                                    text: 'Delete'
                                }, {
                                    xtype: 'textfield',
                                    id: 'configurationDriversCode',
                                    fieldLabel: 'Driver Code'
                                }, {
                                    xtype: 'textfield',
                                    id: 'configurationDriversName',
                                    fieldLabel: 'Driver Name'
                                }, {
                                    xtype: 'textfield',
                                    id: 'configurationDriversLicense',
                                    fieldLabel: 'Driver License nr'
                                }, {
                                    xtype: 'textfield',
                                    id: 'configurationDriversGivenName',
                                    fieldLabel: 'Driver Given Name'
                                }, {
                                    xtype: 'textfield',
                                    id: 'configurationDriversFamilyName',
                                    fieldLabel: 'Driver Familiy Name'
                                }, {
                                    xtype: 'textfield',
                                    id: 'configurationDriversPhone',
                                    fieldLabel: 'Driver Phone Nr'
                                }, {
                                    xtype: 'textfield',
                                    id: 'configurationDriversEmail',
                                    fieldLabel: 'Driver Email'
                                }, {
                                    xtype: 'combobox',
                                    id: 'configurationDriversProvider',
                                    fieldLabel: 'Provider',
                                    displayField: 'name',
                                    store: 'comboProviders',
                                    valueField: 'id'
                                }, {
                                    xtype: 'textareafield',
                                    id: 'configurationDriversMemo',
                                    fieldLabel: 'Memo'
                                }, {
                                    xtype: 'button',
                                    handler: function (button, event) {
                                        var form = document.forms;

                                        Ext.MessageBox.alert('Submitted Values', form.getValues(true));


                                    },
                                    height: 37,
                                    id: 'configurationDriversSave',
                                    text: 'Save'
                                }]
                            }, {
                                xtype: 'gridpanel',
                                height: 300,
                                id: 'configurationDriversGrid',
                                itemId: 'configurationDriversGrid',
                                animCollapse: false,
                                collapsible: true,
                                title: 'Drivers',
                                store: 'gridDrivers',
                                viewConfig: {

                                },
                                columns: [{
                                    xtype: 'gridcolumn',
                                    dataIndex: 'id',
                                    text: 'Id'
                                }, {
                                    xtype: 'gridcolumn',
                                    dataIndex: 'version',
                                    text: 'Version'
                                }, {
                                    xtype: 'gridcolumn',
                                    dataIndex: 'driverId',
                                    text: 'DriverId'
                                }, {
                                    xtype: 'gridcolumn',
                                    dataIndex: 'firstName',
                                    text: 'FirstName'
                                }, {
                                    xtype: 'gridcolumn',
                                    dataIndex: 'middleName',
                                    text: 'MiddleName'
                                }, {
                                    xtype: 'gridcolumn',
                                    dataIndex: 'lastName',
                                    text: 'LastName'
                                }, {
                                    xtype: 'gridcolumn',
                                    dataIndex: 'email',
                                    text: 'Email'
                                }, {
                                    xtype: 'gridcolumn',
                                    dataIndex: 'workPhone',
                                    text: 'WorkPhone'
                                }, {
                                    xtype: 'gridcolumn',
                                    dataIndex: 'note',
                                    text: 'Note'
                                }, {
                                    xtype: 'gridcolumn',
                                    dataIndex: 'licenseNumber',
                                    text: 'LicenseNumber'
                                }, {
                                    xtype: 'gridcolumn',
                                    dataIndex: 'providerId',
                                    text: 'ProviderId'
                                }]
                            }]
                        }]
                    }]
                }]
            }]
        });

        me.callParent(arguments);
    }

});

2 个答案:

答案 0 :(得分:1)

如果没有小提琴或一些简单的样本,很难说什么,但看着你的代码,我注意到一件有趣的事情:

您只有顶级layout: border,然后内部有许多嵌套面板。尝试在包含两个正在折叠的面板的容器中定义border布局。

答案 1 :(得分:0)

如果您打算使用边框布局,您可能需要参考:http://docs.sencha.com/ext-js/4-0/#!/example/layout/border.html我只是在东西面板上使用它来隐藏和显示事件触发器的其他信息。由于您已经拥有ID,因此最好手动触发这些ID。