Extjs searchfield无法读取未定义的属性'hasOwnProperty'

时间:2016-05-31 20:46:52

标签: javascript extjs

我有下一家商店:

  void foo(int ***arr,int width,int height)
        {
        *arr=new int*[width];
        for(int i=0;i<height;i++)
        {
        *arr[i]=new int[height];
        }
        //fill...
        }
    ...
    int **array;
    foo(&array)

和这个模型:

Ext.define('Invoices.store.Invoice', {
extend: 'Ext.data.Store',
model: 'Invoices.model.Invoice',
alias: 'store.InvoiceStore',


remoteFilter: false,
proxy: {
    type: 'ajax',
    url: '/invoices/filter',
    reader: {
        type: 'json'
    }
},

autoLoad: false
});

当我从视图中调用此组件时,显示错误:

Ext.define('Invoices.model.Invoice', {
    extend: 'Ext.data.Model',
    fields: ['data']
});

这发生在SearchField组件主类的下一行代码中:

{
    xtype: 'searchfield',
    name: 'client',
    store: 'InvoiceStore',
    fieldLabel: 'Cliente<b><span style="color: #d32f2f">*</span></b>'
},

Uncaught TypeError: Cannot read property 'hasOwnProperty' of undefined

我认为它发生的原因是传递给组件的null引用,也许是存储,但我更改了别名和模型,但没有发生任何事情,仍然显示相同的错误。

有任何帮助吗?任何的想法?我应该被解雇吗?

1 个答案:

答案 0 :(得分:1)

据我所知,你不能在任何地方创建商店实例。如果您只是传递字符串,则表示它是已存在商店的ID。如果你想通过别名创建商店(这是我认为你正在尝试做的事情),那么你需要像这样指定它:

store: {
    type: 'InvoiceStore'
}