Extjs 改变grid行的背景颜色

## Ext grid 改变行背景色

Ext.util.CSS.createStyleSheet('.ts {background:#9a9a9bc2;}');//单独创建css样式

 {

  xtype: 'gridbase',
  region: 'north',
  title: '不含增值税(单位:万元)',
  titleAlign: "center",
  dockedItems: [
  {
  xtype: 'toolbar',
  weight: -10,
  items: [
     {
      xtype: 'mybutton',
      btnType: 'winsave',
      handler: Ext.bind(me._save, me)
     }
    ]
  }
],
id: 'grid1',
plugins: [Ext.create('Ext.grid.plugin.CellEditing', {clicksToEdit: 1})],
store: _store1,
pagingtoolbar: false,
isLineFeed: true,
viewConfig: {
    //重点代码
getRowClass: function (record, rowIndex, rowParams, store) { **
//设置条件,然后返回想展示的样式
if (rowIndex === 1 || rowIndex === 3) {
return 'ts';//样式名字
 } else {
return ""
}
}
 },
columns: {
defaults: {
align: 'center',
}
},
items: []//表头
},

猜你喜欢

转载自www.cnblogs.com/fengziblog/p/10607250.html