日期:2014-05-16 浏览次数:20368 次
.x-grid-back-red { background: #FF0000; }
{header:'摘要',dataIndex:'zhaoyao',align:'left',width:150, renderer : function(v,m){ m.css='x-grid-back-red'; return v; } }
grid.getStore().on('load',function(s,records){ var girdcount=0; s.each(function(r){ if(r.get('zy')=='本期合计'){ grid.getView().getRow(girdcount).style.backgroundColor='#FFFF00'; }else if(r.get('zy')=='本年累计'){ grid.getView().getRow(girdcount).style.backgroundColor='#FF1493'; }else if(r.get('zy')=='期初余额'){ grid.getView().getRow(girdcount).style.backgroundColor='#DCDCDC'; } girdcount=girdcount+1; }); });效果图如下:
//修改GRID某一行样式 grid.getView().addRowClass(r,css) //修改grid某一单元格样式 Ext.get(grid.getView().getCell(r,c)).addClass(css) 或 grid.getView().getRow(r).style.backgroundColor="red"; //css样式为自定义样式