【问题标题】:Set background color of summary row of extjs grid设置extjs网格摘要行的背景颜色
【发布时间】:2013-11-23 01:48:55
【问题描述】:

启用摘要网格;

Ext.create('Ext.grid.Panel', {
            features: [{
                ftype: 'summary'
            }],

将 summaryType 配置添加到您需要的列;

columns: [{
    dataIndex: 'name',
    text: 'Name',
    summaryType: 'sum',
...

自定义 summaryType 的样子;

dataIndex: 'subtotal',
text: 'SubTotal',
summaryType: function(records){
    return 100*100;//custom function
} 

简单的css添加改变extjs网格摘要行的背景颜色;

.x-grid-row-summary {
    background-color: #efefef;
}

自定义摘要渲染;

{
     dataIndex: 'count',
     text: 'Count',
     summaryType: 'count',
     summaryRenderer: function(value, summaryData, dataIndex) {
         return (value && value>100)?"<font color='red'>"+value+"<font>":value; 
     }
},

【问题讨论】:

  • 您对更改网格摘要行的 bgcolor 有任何疑问或发帖吗?

标签: extjs background-color summary


【解决方案1】:

只需在css样式下方添加

.x-grid-row-summary {
    background-color: #efefef;
}

【讨论】:

  • 抱歉 2 年后提出问题。希望得到回应。如何动态更改摘要行背景颜色?以上将更改我想的所有摘要行的背景颜色。我想根据每个摘要行的某些条件更改颜色。
  • 你可以使用:“summaryRenderer:function()”来操作summay单元格和行,只需为这个记录元素设置一个css类
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2014-03-21
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2013-10-30
相关资源
最近更新 更多