extjs 4Uncaught TypeError: Cannot read property 'items' of undefined
extjs 4Uncaught TypeError: Cannot read property 'items' of undefined
我想通过示例 data.But 加载带有商店和模型的图表,当加载数据时出现错误:无法读取未定义的 属性 'items'
我在控制器中创建商店和模型并设置图表值:
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'
},
}
],
});
我想将此图表添加到面板
Ext.ComponentQuery.query('panel')[0].add(chart);
无法读取 属性 'items' 未定义即将到来,因为您正在直接创建模型实例而没有定义。
这里是fiddlehttp://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)}
]
})
我想通过示例 data.But 加载带有商店和模型的图表,当加载数据时出现错误:无法读取未定义的 属性 'items' 我在控制器中创建商店和模型并设置图表值:
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'
},
}
],
});
我想将此图表添加到面板
Ext.ComponentQuery.query('panel')[0].add(chart);
无法读取 属性 'items' 未定义即将到来,因为您正在直接创建模型实例而没有定义。
这里是fiddlehttp://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)}
]
})