+ -
当前位置:首页 → 问答吧 → EXT3.3.0中的继承的问题,请教EXT达人

EXT3.3.0中的继承的问题,请教EXT达人

时间:2011-12-02

来源:互联网

为什么使用on异常

JScript code
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();
    
/////////////////////////////////////
    
    
})

作者: jinweifu   发布时间: 2011-12-02

改成这样试试 localStore.on('load',function(store,options){

作者: A_Q111   发布时间: 2011-12-03