1

我似乎在这里遇到了一个奇怪的问题。扩展组件具有以下代码:

MyApp.panels.RelationshipDetails = Ext.extend(Ext.FormPanel, {
    closable: true,
    relationshipId: null,
    documentId: null,
    title: 'Relationship',
    initComponent: function () {
        if (!this.verifyRequiredData()) {
            MyApp.panels.RelationshipDetails.superclass.initComponent.call(this);
            return;
        }

        // Build components
        this.tbar = this.buildToolbar();
        this.items = this.buildDetailItemArray();

        MyApp.panels.RelationshipDetails.superclass.initComponent.call(this);
    },

    verifyRequiredData: function () {
        // Verification code here
    },

    buildDetailItemArray: function () {
        return [{
            xtype: 'fieldset',
            title: 'Details',
            collapsible: true,
            autoHeight: true,
            items: [{
                xtype: 'hidden',
                name: 'Id'
            }, {
                xtype: 'textfield',
                fieldLabel: 'Name',
                name: 'Name'
            }, {
                xtype: 'textfield',
                fieldLabel: 'Description',
                name: 'Description'
            }, {
                xtype: 'button',
                text: 'Save',
                name: 'saveButton'
            }]
        }];
    },

    buildToolbar: function () {
        return new Ext.Toolbar({
            // Toolbar Config
        });
    }
});

问题是当这个面板呈现时,工具栏是唯一呈现的东西。通过调试,我可以看到它BuildDetailItemArray()被正确调用并返回正确的结果。

当我注释掉该this.tbar =行时,它变得更加奇怪,因为当工具栏不存在时,字段集和字段会正确呈现。即使我扩展Panel而不是FormPanel. 我还尝试将表单字段抽象到它自己的组件中,并且发生了同样的事情。

任何人都知道为什么这似乎不起作用?

4

1 回答 1

1

您要将此面板放入哪种布局?另外,您是否为此面板设置了高度?

通常,如果您没有指定要添加的组件的高度(在您的情况下是此面板),或者如果使用 AnchorLayout 则没有设置锚点,则不会显示组件内容,但工具栏仍然将要。

最好在您的整体布局中了解此面板的上下文。

于 2010-12-16T16:43:10.127 回答