Cordova 已添加所需的DataView配置,但仍出现错误?(第三方物流:与第三方物流)

Cordova 已添加所需的DataView配置,但仍出现错误?(第三方物流:与第三方物流),cordova,sencha-touch,extjs,Cordova,Sencha Touch,Extjs,我正在使用MVC示例,绕过了PhoneGap contacts数据,用我自己的模型和存储替换了它。当我向面板添加列表时,我会将其指向myApp.stores.products。列表是一个数据视图,因此需要tpl、store和itemSelector,但该示例省略了itemSelector,并使用itemTpl而不是tpl items: [{ xtype: 'list', store: myApp.stores.products, itemTpl:

我正在使用MVC示例,绕过了PhoneGap contacts数据,用我自己的模型和存储替换了它。当我向面板添加列表时,我会将其指向myApp.stores.products。列表是一个数据视图,因此需要
tpl
store
itemSelector
,但该示例省略了
itemSelector
,并使用
itemTpl
而不是
tpl

items: [{
        xtype: 'list',
        store: myApp.stores.products,
        itemTpl: '{productName}',
        onItemDisclosure: function (record) {
            //Ext.dispatch({
            //    controller: myApp.controllers.products,
            //    action: 'show',
            //    id: record.getId()
            //});
        }
    }]
当然,我会收到如下控制台警告:

未捕获的DataView要求定义tpl、store和itemSelector配置

所以,我将配置更改为我知道的配置,现在得到一个错误

items: [{
    xtype: 'list',
    store: myApp.stores.products,
    tpl: '{productName}',
    itemSelector: 'div.productView',
    onItemDisclosure: function (record) {
        //Ext.dispatch({
        //    controller: myApp.controllers.products,
        //    action: 'show',
        //    id: record.getId()
        //});
    }
}]
未捕获错误:Ext.List:itemTpl是必需的配置

那么,是哪一个?第三方物流还是第三方物流?为什么Ext.List不知道使用哪一个?为了安全起见,我甚至尝试添加了
tpl
itemTpl
,但仍然得到了上面两个错误中的第一个错误

注意: 这是它在面板上下文中的外观:

myApp.views.ProductList = Ext.extend(Ext.Panel, {
    dockedItems: [{
        xtype: 'toolbar',
        title: 'Products'
    }],
    items: [{
        xtype: 'list',
        store: myApp.stores.products,
        tpl: '{productName}',
        itemSelector: 'div.productView',
        onItemDisclosure: function (record) {
            //Ext.dispatch({
            //    controller: myApp.controllers.products,
            //    action: 'show',
            //    id: record.getId()
            //});
        }
    }],
    initComponent: function() {
        myApp.stores.products.load();
        myApp.views.ProductList.superclass.initComponent.apply(this, arguments);
    }
});
更新: 我想它在initComponent.apply()上呕吐


好的。在Sencha Touch initComponent函数中设置一个断点,我发现它与tpl或itemTpl没有任何关系。不知怎的,我的商店还没有定义。现在进入一个新的谜团


创建此面板和列表时未定义存储。因此,最终的解决方案是改变.js文件包含在index.html中的顺序。现在就像一个幸运符。

我也遇到了同样的问题,但对我来说,问题是用于调用代理的变量名中有一个错误:我在需要小写时使用大写。 代码示例:我使用了myApp.stores.Products而不是myApp.stores.Products


但要找到……需要时间。

是的。这是一个容易犯的错误,但很难发现。一个好的约定是将类定义的第一个字母大写,并将对象实例的第一个字母小写。你完全正确,这是我在Java项目中所做的,但我不知道为什么我在Js PhoneGap项目中没有这样做。。。
myApp.views.ProductList.superclass.initComponent.apply(this, arguments);