gpt4 book ai didi

javascript - 在 View 中显式实例化商店时出错

转载 作者:行者123 更新时间:2023-11-30 17:38:53 25 4
gpt4 key购买 nike

我有这样的看法:

Ext.define('MyApp.view.CustomersList', {
extend: 'Ext.grid.Panel',

store: Ext.create('MyApp.store.Customers'),

columns: [
{
width: 150,
dataIndex: 'customerName',
text: 'CustomerName'
},
{
width: 200,
dataIndex: 'customerNumber',
flex: 1,
text: 'CustomerNumber'
}
]
});

我明确地实例化了一个商店,但是当我在 Viewport 中加载这个 View 时,我发现了这样的错误:

Uncaught TypeError: Expecting a function in instanceof check, but got function constructor() {
// Opera has some problems returning from a constructor when Dragonfly isn't running. The || null seems to
// be sufficient to stop it misbehaving. Known to be required against 10.53, 11.51 and 11.61.
return this.constructor.apply(this, arguments) || null;
}

Uncaught TypeError: Expecting a function in instanceof check, but got function constructor() {
// Opera has some problems returning from a constructor when Dragonfly isn't running. The || null seems to
// be sufficient to stop it misbehaving. Known to be required against 10.53, 11.51 and 11.61.
return this.constructor.apply(this, arguments) || null;
}

最佳答案

    Ext.define('MyApp.view.CustomersList', {
extend: 'Ext.grid.Panel',

initComponent: function(){
this.store = Ext.create('MyApp.store.Customers');

this.columns = [
{
width: 150,
dataIndex: 'customerName',
text: 'CustomerName'
},
{
width: 200,
dataIndex: 'customerNumber',
flex: 1,
text: 'CustomerNumber'
}]
this.callParent();
}
});

希望对您有所帮助!

关于javascript - 在 View 中显式实例化商店时出错,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21472574/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com