1
我想创建一个可以重复使用的简单商店,只包含几年。在商店创建中静态定义商店中的数据
Ext.define('Workshop.store.YearsStore',
{
extend: 'Ext.data.Store',
fields: ['id', 'type'],
constructor: function(config)
{
var years = [];
for(var n=1972;n<=Ext.Date.format(new Date(), 'Y');n++)
{
years.push({id: n, type: n});
}
config.data = years;
this.initConfig(config);
return this;
}
});
这不起作用,我如何定义商店创建的静态数据集?