简体   繁体   English

extjs 4Uncaught TypeError:无法读取未定义的属性“ items”

[英]extjs 4Uncaught TypeError: Cannot read property 'items' of undefined

i want load a chart with store and model by sample data.But when loading data get a error: Cannot read property 'items' of undefined i creating a store and model in conroller and set chart values: 我想通过样本数据加载带有商店和模型的图表,但是加载数据时出现错误:无法读取未定义的属性``项目'',我在控制器中创建了商店和模型并设置了图表值:

var chart = Ext.create('Ext.chart.Chart', {
                    animate: true,
                    store: Ext.create('Ext.data.Store', {
                        model: Ext.create('Ext.data.Model', {
                                fields: ['temperature', 'date']
                            }
                        ),
                        data: [
                            {temperature: 58, date: new Date(2011, 1, 1, 8)},
                            {temperature: 63, date: new Date(2011, 1, 1, 9)},
                            {temperature: 73, date: new Date(2011, 1, 1, 10)},
                            {temperature: 78, date: new Date(2011, 1, 1, 11)},
                            {temperature: 81, date: new Date(2011, 1, 1, 12)}
                        ]
                    }),
                    axes: [{
                        type: 'numeric',
                        position: 'left',
                        title: 'y',
                        minimum: 0
                    },
                        {
                            type: 'date',
                            position: 'bottom',
                            title: 'x',
                            minimum: 0
                        }],
                    series: [{
                        type: 'column',
                        axis: 'left',
                        highlight: true,
                        tips: {
                            trackMouse: true,
                            width: 140,
                            height: 28
                        }
                    },
                        {
                            label: {
                                display: 'insideEnd',
                                'text-anchor': 'middle',
                                renderer: Ext.util.Format.numberRenderer('0'),
                                orientation: 'vertical',
                                color: '#333'
                            },
                        }
                    ],
                });

and i want add this chart to panel 我想将此图表添加到面板

Ext.ComponentQuery.query('panel')[0].add(chart);

Cannot read property 'items' of undefined is coming as you are directly creating instance of model with out defining . 无法直接读取未定义的模型实例时,无法读取undefined的属性“ items”。

Here is the fiddle http://jsfiddle.net/djaydxnd/66/ 这是小提琴http://jsfiddle.net/djaydxnd/66/

 store: Ext.create('Ext.data.Store', {
       model:Ext.define('chart', {
           extend: 'Ext.data.Model',
           fields: ['temperature','date']
       }),                      
       data: [
                                  {temperature: 58, date: new Date(2011, 1, 1, 8)},
                                {temperature: 63, date: new Date(2011, 1, 1, 9)},
                                {temperature: 73, date: new Date(2011, 1, 1, 10)},
                                {temperature: 78, date: new Date(2011, 1, 1, 11)},
                                {temperature: 81, date: new Date(2011, 1, 1, 12)}

      ]
     })

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Extjs 4.1:如此奇怪的错误:未捕获TypeError:无法读取未定义的属性'items' - Extjs 4.1: So strange error: Uncaught TypeError: Cannot read property 'items' of undefined Extjs5 treepanel [未捕获的TypeError:无法读取未定义的属性'create'] - Extjs5 treepanel [Uncaught TypeError: Cannot read property 'create' of undefined] ExtJs错误:未捕获TypeError:无法读取未定义的属性'removeCls' - ExtJs Error: Uncaught TypeError: Cannot read property 'removeCls' of undefined ExtJS:未捕获的TypeError:无法读取未定义的属性“作用域” - ExtJS: Uncaught TypeError: Cannot read property 'scope' of undefined 未捕获的TypeError:无法读取未定义的属性'responseText' - Uncaught TypeError: Cannot read property 'responseText' of undefined 未捕获的类型错误:无法读取未定义的属性“dom” - Uncaught TypeError: Cannot read property 'dom' of undefined 未捕获的TypeError:无法读取未定义的属性'getProxy' - Uncaught TypeError: Cannot read property 'getProxy' of undefined 未捕获的类型错误:无法读取未定义的属性“isSynchronized” - Uncaught TypeError: Cannot read property 'isSynchronized' of undefined EXTJS 6 Modern:缓冲存储+网格:未捕获的TypeError:无法读取未定义的属性'length' - EXTJS 6 Modern: buffered store + grid: Uncaught TypeError: Cannot read property 'length' of undefined Extjs查看渲染问题,Uncaught TypeError:无法读取未定义的属性'tooNarrow' - Extjs view rendering issue,Uncaught TypeError: Cannot read property 'tooNarrow' of undefined
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM