ExtJs GridPanel 自定义汇总

{
  text: '订单金额',
  dataIndex: 'amount',
  renderer: function(value){
    return Ext.util.Format.number(value, '0.00'); 
  },
  summaryType: function(records) {
    var amount = 0;
    var length = records.length;
    for(var i = 0; i < length; i++) {
      var record = records[i];
      if(record.get('payType') == 'alipay') {     // 汇总条件 
        amount += record.get('amount');      // 汇总方式
      }
    }
    return Ext.util.Format.number(amount, '0.00');
  }
}

  


column_ofYouWant.summaryType=function(records){return 888;};

{
  text: '订单金额',
  dataIndex: 'amount',
  renderer: function(value){
    return Ext.util.Format.number(value, '0.00'); 
  },
  summaryType: 'sum',
  summaryRenderer: function(value){
    return '<span style="color:red">' + Ext.util.Format.number(value, '0.00') + '</span>';
  }
}

 

column_ofYouWant.summaryType=function(value){
    return '<span style="color:red">' + Ext.util.Format.number(value, '0.00') + '</span>';
  };
posted on 2023-05-19 12:08  wakaka_wka  阅读(50)  评论(0编辑  收藏  举报