Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/opencv/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 商店根本不工作_Extjs_Sencha Touch 2_Sencha Architect - Fatal编程技术网

Extjs 商店根本不工作

Extjs 商店根本不工作,extjs,sencha-touch-2,sencha-architect,Extjs,Sencha Touch 2,Sencha Architect,我正在尝试运行的代码: var test = Ext.create(APPNAME+'.model.Category'); test.set('strTitle','batard'); Ext.getStore('categorystore').add(test); **APPNAME是一个设置为应用程序名称/命名空间的全局变量,它在每一个应用程序中都能正常工作,并且在这段代码中它不是一行崩溃 模型类别定义: Ext.define('CarboZero.model.Category', {

我正在尝试运行的代码:

var test = Ext.create(APPNAME+'.model.Category');
test.set('strTitle','batard');
Ext.getStore('categorystore').add(test);
**APPNAME是一个设置为应用程序名称/命名空间的全局变量,它在每一个应用程序中都能正常工作,并且在这段代码中它不是一行崩溃

模型类别定义:

Ext.define('CarboZero.model.Category', {
    extend: 'Ext.data.Model',

    config: {
        fields: [
            {
                name: 'strTitle'
            },
            {
                name: 'numTotal'
            },
            {
                name: 'arrSubCategory'
            },
            {
                name: 'arrSubTotal'
            }
        ]
    }
});
Ext.define('CarboZero.store.CategoryStore', {
    extend: 'Ext.data.Store',

    requires: [
        'CarboZero.model.Category'
    ],

    config: {
        clearOnPageLoad: false,
        model: 'CarboZero.model.Category',
        storeId: 'categorystore'
    }
});
门店定义:

Ext.define('CarboZero.model.Category', {
    extend: 'Ext.data.Model',

    config: {
        fields: [
            {
                name: 'strTitle'
            },
            {
                name: 'numTotal'
            },
            {
                name: 'arrSubCategory'
            },
            {
                name: 'arrSubTotal'
            }
        ]
    }
});
Ext.define('CarboZero.store.CategoryStore', {
    extend: 'Ext.data.Store',

    requires: [
        'CarboZero.model.Category'
    ],

    config: {
        clearOnPageLoad: false,
        model: 'CarboZero.model.Category',
        storeId: 'categorystore'
    }
});
我得到的错误是:

它可以追溯到这一行代码

Ext.getStore('categorystore').add(test);
对我来说,这没有任何意义,我有没有用另一种型号做过完全相同的事情,它工作得非常完美。。。但是这种类型的模型只是不。。。这很令人沮丧

经过进一步的调试,我可以确定触发错误的是以下代码示例中的任何一个,它们是崩溃存储(categoryStore)使用的Dataview和Dataview项

数据视图代码

{
     xtype: 'dataview',
     itemId: 'category_List',
     ui: 'round',
     defaultType: 'categorytag',
     store: 'categorystore',
     useComponents: true
}
数据视图项目代码

Ext.define('CarboZero.view.CategoryTag', {
    extend: 'Ext.dataview.component.DataItem',
    alias: 'widget.categorytag',

    config: {
        padding: 10,
        autoDestroy: false,
        layout: {
            type: 'hbox'
        },
        items: [
            {
                xtype: 'label',
                html: 'CategoryTitle',
                itemId: 'category_Label'
            },
            {
                xtype: 'spacer',
                itemId: 'spacer'
            },
            {
                xtype: 'label',
                html: 'Total',
                itemId: 'total_Label'
            }
        ]
    },

    updateRecord: function(record) {
        var me = this;

        me.getComponent('category_Label').setHtml(record['strTitle']);
        me.getComponent('total_Label').setHtml(record['numTotal']);


    }

});

仅供参考:奇怪的是,Dataview和Dataview项的这种配置确实工作了一段时间

你的代码似乎很有用。您应该在sencha-touch-all.js中发生错误的精确行上放置一个条件断点,并查看未定义的内容。。。这通常是当缺少
xtype
、网格列或类似内容时出现的错误。是我还是您的错误根本不可见…?只需单击鼠标左键并在新选项卡中打开,您就会看到它。如何在chrome中添加和使用断点OOkay刚刚又做了几次调试。。。我幸运地发现我的数据列表和数据列表项是我的商店崩溃的原因。。。将使用codeDeleted my Dataview项目更新qustion。。。从头开始重新创建它。。。同样的事情,它现在起作用了。。。。