Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/extjs/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Forms ExtJS:Ext.form.Panel标头在实现beforeRender事件时丢失_Forms_Extjs_Header_Extjs4_Render - Fatal编程技术网

Forms ExtJS:Ext.form.Panel标头在实现beforeRender事件时丢失

Forms ExtJS:Ext.form.Panel标头在实现beforeRender事件时丢失,forms,extjs,header,extjs4,render,Forms,Extjs,Header,Extjs4,Render,在ExtJS 4.2中,每当将“beforeRender”事件放入Ext.form.Panel定义中,并创建该定义的实例时,面板的标题就会消失。是否有一种方法可以覆盖框架功能以显示标题(包含我的标题标签)?不确定这是否有区别,但我在视口中使用“边框”布局 缺少面板标题(带标题): Ext.define('App.view.module1.Activity1', { extend: 'Ext.form.Panel', xtype: 'view-module1-activity1',

在ExtJS 4.2中,每当将“beforeRender”事件放入Ext.form.Panel定义中,并创建该定义的实例时,面板的标题就会消失。是否有一种方法可以覆盖框架功能以显示标题(包含我的标题标签)?不确定这是否有区别,但我在视口中使用“边框”布局

缺少面板标题(带标题):

Ext.define('App.view.module1.Activity1', {
    extend: 'Ext.form.Panel',
    xtype: 'view-module1-activity1',
    title: 'this header does not show up',
    beforeRender: function() {        
    },    
});
Ext.define('App.view.module1.Activity1', {
    extend: 'Ext.form.Panel',
    xtype: 'view-module1-activity1',
    title: 'this header does show up',    
    //beforeRender: function() {        
    //},    
});

显示面板标题(带标题):

Ext.define('App.view.module1.Activity1', {
    extend: 'Ext.form.Panel',
    xtype: 'view-module1-activity1',
    title: 'this header does not show up',
    beforeRender: function() {        
    },    
});
Ext.define('App.view.module1.Activity1', {
    extend: 'Ext.form.Panel',
    xtype: 'view-module1-activity1',
    title: 'this header does show up',    
    //beforeRender: function() {        
    //},    
});

我仔细检查了标题是否存在但只是隐藏了,或者根本不存在。是后者。这是呈现标题时div的外观。此HTML显示在实际视图div标记下。当由于“beforeRender”事件而缺少标头时,此HTML块根本不会显示

<div class="x-panel-header x-header x-header-horizontal x-docked x-unselectable x-panel-header-default x-horizontal x-panel-header-horizontal x-panel-header-default-horizontal x-top x-panel-header-top x-panel-header-default-top x-docked-top x-panel-header-docked-top x-panel-header-default-docked-top" id="view-module1-activity1-1046_header" style="right: auto; left: 0px; top: 0px; width: 803px;">
    <div id="view-module1-activity1-1046_header-body" class="x-header-body x-panel-header-body x-panel-header-body-default x-panel-header-body-horizontal x-panel-header-body-default-horizontal x-panel-header-body-top x-panel-header-body-default-top x-panel-header-body-docked-top x-panel-header-body-default-docked-top x-box-layout-ct x-panel-header-body-default-horizontal x-panel-header-body-default-top x-panel-header-body-default-docked-top" style="width: 791px;">
        <div id="view-module1-activity1-1046_header-innerCt" class="x-box-inner " role="presentation" style="width: 791px; height: 16px;">
            <div id="view-module1-activity1-1046_header-targetEl" class="x-box-target" style="width: 791px;">

                <div class="x-component x-header-text-container x-panel-header-text-container x-panel-header-text-container-default x-box-item x-component-default" unselectable="on" id="view-module1-activity1-1046_header_hd" style="right: auto; left: 0px; top: 0px; margin: 0px; width: 791px;"><span id="view-module1-activity1-1046_header_hd-textEl" class="x-header-text x-panel-header-text x-panel-header-text-default" unselectable="on">this header does show up</span>
                </div>

            </div>
        </div>
    </div>
</div>

这个标题确实出现了

两件事。首先,在函数后面有一个额外的逗号。其次,
beforeRender
需要
callParent()


您好,您可以这样做:

Ext.define('App.view.module1.Activity1', {
extend: 'Ext.form.Panel',
xtype: 'view-module1-activity1',
title: 'this header does not show up',
initComponent: function() {

  // code to run when component is created

  this.callParent(arguments);
},
beforeRender: function () {
    // code

 }    
});

谢谢逗号是我为了避免混淆而把这个问题的细节去掉的一部分。