许多网友不知道“easyUI怎样设置所有行的背景颜色”,今天小编就讲一下“easyUI怎样设置所有行的背景颜色”的方法。
工具/原料
1
easyUI
2
PC
方法/步骤
1
当 listprice 值大于 50 时,将为该行设置不同的颜色。如图所示,
2
数据网格(datagrid)的 rowStyler 函数的设计目的是允许您自定义行样式。以下代码展示如何改变行样式:
3
Item ID | Product ID | List Price | Unit Cost | Attribute | Stauts |
---|
4
$('#tt').datagrid({ rowStyler:function(index,row){ if (row.listprice>50){ return 'background-color:pink;color:blue;font-weight:bold;'; } } });
5
正如所看到的,根据一些条件设置 background-color(背景色)为 pink(粉红色),设置文本颜色为 blue(蓝色)。
注意事项
如果大家看不懂代码的话,可以咨询一下专业人士哦!
下一篇:香薰蜡片怎么使用