extjs grid行背景设置颜色

转载自:https://blog.csdn.net/qq_17505335/article/details/52538637?utm_medium=distribute.pc_aggpage_search_result.none-task-blog-2~all~first_rank_v2~rank_v25-1-52538637.nonecase

 

 


1
Ext.define('V5.digao.view.Grid', { 2 extend : 'Ext.grid.Panel', 3 columnLines : true, 4 xtype : 'cxbGrid', 5 border : 0, 6 id : 'cxb', 7 viewConfig:{getRowClass:changeRowClass}, 8 store : Ext.create('Ext.data.Store', { 9 fields : ['ywzl','ywdy',"digao", "creator", 'status','wt','gz','jy'], 10 data : [{ 11 'ywzl':'业务条线1', 12 13 ........................................................................................................ 14 15 ........................................................................................................... 16 17 function changeRowClass(record, rowIndex, rowParams, store){ 18 if(record.get('status') == '未创建'){ 19 return "x-grid-black"; 20 } 21 if(record.get('status') == '草稿'){ 22 return "x-grid-red"; 23 } 24 if(record.get('status') == '审计完成'){ 25 return "x-grid-record-green"; 26 } 27 if(record.get('status') == '审批退回'){ 28 return "x-grid-record-yellow"; 29 } 30 } 31 32 33 34 设计自定义样式: 35 36 tr.x-grid-black .x-grid-td{ 37 background:gray; 38 } 39 40 41 tr.x-grid-red .x-grid-td{ 42 background:red; 43 } 44 45 46 tr.x-grid-record-green .x-grid-td { 47 background:green; 48 } 49 50 51 tr.x-grid-record-yellow .x-grid-td { 52 background: yellow; 53 }

 

posted @ 2020-08-10 17:20  六月雨  阅读(1086)  评论(0编辑  收藏  举报