无法读取未定义Extjs 4的属性'isTree' [英] Cannot read property 'isTree' of undefined Extjs 4

查看:146
本文介绍了无法读取未定义Extjs 4的属性'isTree'的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图将extjs2的代码更新为extjs4,但是我有一个错误,并且 grid 出了问题。我的Google Chrome浏览器返回错误无法读取未定义的属性'isTree'

  Ext.define('App.grid.GridPanel',{
extend:'Ext.grid.GridPanel',
别名:'widget.gridpanel',
frame:false,
loadMask:true,
stateful:false,
enableColumnHide:false,
showGridHeader:true,
viewConfig:{
stripeRows:true
},

initComponent:function(){
if(!this.showGridHeader){
this.addClass('grid-no-header');
}

App.grid.GridPanel.superclass.initComponent.apply(this,arguments);
},

getView:function(){
if(! this.view){
this.view = new App.grid.GridView(this.viewConfig);
}
return this.view;
}
}) ;



 var grid = new App.grid.GridPanel({
store:store ,
列:gridColumns,
frame:false,
// autoExpandColumn:'name',
autoHeight:true,
loadMask:true,
bbar :pagingBar,
viewConfig:{
stripeRows:true,
scrollOffset:2
}
});

即使当我将 App.grid.GridPanel.superclass.initComponent.apply(this,arguments); 更改为 this.callParent( this,arguments); 我收到了同样的错误。
请帮助。

解决方案

您不应该使用 widget.gridpanel 作为你的网格的别名,因为已经有一个xtype的 gridpanel http://docs.sencha.com/extjs/4.1.3/#!/api/Ext.grid.Panel

另外getView怎么回事?你没有提供它的实现。



在你的initComponent方法中,按照指南中的说明使用this.callParent()。



将配置降至最低以使其处于正常工作状态,然后添加您认为必须的部分。


I trying to update code from extjs2 to extjs4, but I have an error and something wrong with grid. My Google Chrome browser return error Cannot read property 'isTree' of undefined

    Ext.define('App.grid.GridPanel', {
    extend: 'Ext.grid.GridPanel',
    alias: 'widget.gridpanel',
    frame: false,
    loadMask: true,
    stateful: false,
    enableColumnHide: false,
    showGridHeader: true,
    viewConfig: {        
        stripeRows: true
    },

    initComponent: function() {
        if (!this.showGridHeader) {
            this.addClass('grid-no-header');
        }

        App.grid.GridPanel.superclass.initComponent.apply(this, arguments);
    },

    getView : function(){
        if(!this.view){
            this.view = new App.grid.GridView(this.viewConfig);
        }
        return this.view;
    }
});

var grid = new App.grid.GridPanel({
        store: store,
        columns: gridColumns,
        frame: false,
    //    autoExpandColumn: 'name',
        autoHeight: true,
        loadMask: true,
        bbar: pagingBar,
        viewConfig: {
            stripeRows: true,
            scrollOffset: 2
        }
    });

Even when I changed App.grid.GridPanel.superclass.initComponent.apply(this, arguments); to this.callParent(this, arguments); I received the same error. Please, help.

解决方案

You should not use widget.gridpanel as the alias for your grid as there is already an xtype of gridpanel http://docs.sencha.com/extjs/4.1.3/#!/api/Ext.grid.Panel .

Also whats going on with the getView ? You are not providing the implementation for it.

In your initComponent method use this.callParent() as stated in the guides.

Reduce the config to the minimum to get it in the working order, then add what you think is necessary piece by piece.

这篇关于无法读取未定义Extjs 4的属性'isTree'的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆