为什么使用on异常app.ux.AggregateStore=Ext.extend(Ext.data.GroupingStore,{
constructor:function(config){
Ext.apply(this,config);
app.ux.AggregateStore.superclass.constructor.call(this);
this.on('load',this.aggregate,this);
},
aggregate:function(){//////实现数据的聚合用于统计图
var rec=null;
this.each(function(record){
if(rec==null||rec.data[this.groupField]!=record.data[this.groupField]){
rec=new this.recordType(record.data,record.data[this.groupField]);
return;
}
if(rec.data[this.groupField]==record.data[this.groupField]){
record.data[this.summaryField]+=rec.data[this.summaryField];
this.remove(rec);
rec=record;
}
},this);
// this.commitChanges();
}
})
Ext.onReady(function(){
//////////////////////////
var board=new app.ux.PrintBoard();
board.initPrintBoard();
var localStore=new app.ux.AggregateStore({
url:'RecordLoader',
root:'data',
groupField:'brand',
fields:['sequenceNumber',
'brand',{
name:'quantity',
type:'int'
},{
name:'total',
type:'float'
}],
baseParams:{
start:0,
limit:50,
data:Ext.encode({
condition:'黄铜',
fields:'fulltext',
target:'detail',
relative:'detail_fields'
})
}
});
localStore.on('load',function(){ ////FIREBUG调试,代码在此处无法执行为什么,该如何修改///////////////////////以下是画统计柱图的代码//////////////////////////
var drawer=new app.ux.ChartDrawer({
fields:['brand','total','quantity'],
// store:this.store,
group:'brand',
xField:'total',
xField1:'quantity',
yDisplayName:'数量',
yDisplayName1:'总额',
localStore:localStore
});
board.draw(drawer,true);
},this)
localStore.load();
/////////////////////////////////////
})
constructor:function(config){
Ext.apply(this,config);
app.ux.AggregateStore.superclass.constructor.call(this);
this.on('load',this.aggregate,this);
},
aggregate:function(){//////实现数据的聚合用于统计图
var rec=null;
this.each(function(record){
if(rec==null||rec.data[this.groupField]!=record.data[this.groupField]){
rec=new this.recordType(record.data,record.data[this.groupField]);
return;
}
if(rec.data[this.groupField]==record.data[this.groupField]){
record.data[this.summaryField]+=rec.data[this.summaryField];
this.remove(rec);
rec=record;
}
},this);
// this.commitChanges();
}
})
Ext.onReady(function(){
//////////////////////////
var board=new app.ux.PrintBoard();
board.initPrintBoard();
var localStore=new app.ux.AggregateStore({
url:'RecordLoader',
root:'data',
groupField:'brand',
fields:['sequenceNumber',
'brand',{
name:'quantity',
type:'int'
},{
name:'total',
type:'float'
}],
baseParams:{
start:0,
limit:50,
data:Ext.encode({
condition:'黄铜',
fields:'fulltext',
target:'detail',
relative:'detail_fields'
})
}
});
localStore.on('load',function(){ ////FIREBUG调试,代码在此处无法执行为什么,该如何修改///////////////////////以下是画统计柱图的代码//////////////////////////
var drawer=new app.ux.ChartDrawer({
fields:['brand','total','quantity'],
// store:this.store,
group:'brand',
xField:'total',
xField1:'quantity',
yDisplayName:'数量',
yDisplayName1:'总额',
localStore:localStore
});
board.draw(drawer,true);
},this)
localStore.load();
/////////////////////////////////////
})
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货