ExtJS GridPanel根據條件改變字型顏色
阿新 • • 發佈:2018-12-30
1、在GridPanel中加入GridView
<View> <ext:GridView ID="GridView1" runat="server"> <GetRowClass Fn="setRowBg" /> </ext:GridView> </View>
2、加入js指令碼
<script language="javascript" type="text/javascript"> function setRowBg(rd, ri, ro) { var zhb,lj,xzh; zhb=rd.data.zhb; lj=rd.data.lj xzh=rd.data.xzh; if (xzh=="正向") { if (zhb>lj) { ro.tstyle = "color: #F57D02; "; } else { ro.tstyle = "background-color:none;"; } } if (xzh=="反向") { if (zhb<lj) { ro.tstyle = "color: #FFE37E; "; } else { ro.tstyle = "background-color:none;"; } } } </script>