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
Extjs 无法读取未定义的/Object的属性“superclass”没有方法“addCls”_Extjs_Overriding_Extend - Fatal编程技术网

Extjs 无法读取未定义的/Object的属性“superclass”没有方法“addCls”

Extjs 无法读取未定义的/Object的属性“superclass”没有方法“addCls”,extjs,overriding,extend,Extjs,Overriding,Extend,-----------解决方案-------------- 我做了一个变通办法,在代码中调用Parent var expandFieldOverride = function(event) { //event: collapse, false / expand, true var fieldset = this; var arguments = [event]; if(!fieldset.readyToExpand){

-----------解决方案--------------

我做了一个变通办法,在代码中调用Parent

 var expandFieldOverride = function(event)
{
    //event: collapse, false / expand, true 
    var fieldset = this; 
    var arguments = [event]; 

    if(!fieldset.readyToExpand){            
        Ext.each(profilesPanel.items.items, function(panel, i)
        {       
            if (panel.isProfilePanel)
            {
                    console.log(event); 
                    var field = panel.down('profileform[title=Standard Configuration]').down('fieldset[name='+fieldset.name+']');
                    field.readyToExpand = true; 
                    field.setExpanded(event); 
            }           
        });
    }
    this.callParent(arguments); 
    fieldset.readyToExpand = false; 
}
-------------初始问题----------------

我正在使用ExtJS 4.2.1,并试图覆盖字段集的折叠和扩展事件。使用collapse和expand不起作用,所以我必须直接重写setExpanded。我试图实现这样一个事件:当一个字段集在配置文件面板中折叠时,另一个字段集在另一个配置文件面板中折叠时,反之亦然

 Ext.define('EcoCentral.Configuration.ThermostatProfiles.ProfileOptionsFieldSet',
{
    extend: 'Ext.form.FieldSet',
    setExpanded: expandFieldOverride,
    //expand: expandFieldOverride,
    //collapse: collapseFieldOverride,
    alias: 'widget.profilefieldset'

});

 var expandFieldOverride = function(event)
{
    //this.callParent(arguments);
    //event: collapse, false / expand, true 
    var fieldset = this; 
    var arguments = [event]; 

    Ext.each(profilesPanel.items.items, function(panel, i)
    {       
        if (panel.isProfilePanel)
        {
            var field = panel.down('profileform[title=Standard Configuration]').down('fieldset[name='+fieldset.name+']');
            console.log(field); 
            //field.callParent(arguments); 
            field.self.superclass.setExpanded.call(arguments); 
        }
        //this.callParent(arguments); 
    });
}
如果我在代码中使用'this.callParentarguments',我会收到 '未捕获的TypeError:无法读取未定义的'superclass'属性'

我做了一些研究并尝试了这一行代码
'field.self.superclass.setExpanded.callarguments;' 我从中得到: 'Uncaught TypeError:对象没有方法'addCls

这是源中setExpanded函数内部的调用

 setExpanded: function(expanded) {
    var me = this,
        checkboxCmp = me.checkboxCmp,
        operation = expanded ? 'expand' : 'collapse';

    if (!me.rendered || me.fireEvent('before' + operation, me) !== false) {
        expanded = !!expanded;

        if (checkboxCmp) {
            checkboxCmp.setValue(expanded);
        }

        if (expanded) {
            me.removeCls(me.baseCls + '-collapsed');
        } else {
            me.addCls(me.baseCls + '-collapsed');
        }
        me.collapsed = !expanded;
        if (expanded) {
            delete me.getHierarchyState().collapsed;
        } else {
            me.getHierarchyState().collapsed = true;
        }
        if (me.rendered) {
            // say explicitly we are not root because when we have a fixed/configured height
            // our ownerLayout would say we are root and so would not have it's height
            // updated since it's not included in the layout cycle
            me.updateLayout({ isRoot: false });
            me.fireEvent(operation, me);
        }
    }
    return me;
},

我的字段集由xtype定义:

您必须使用apply。调用是错误的函数。看看这个:


field.self.superclass.setExpanded.applyarguments;我使用apply收到了相同的错误。这就是你说的吗?