easyui 改变单元格背景颜色

另外一种方法:https://www.cnblogs.com/raitorei/p/9989649.html

代码:

jsp:

<table id="roleList">
        <thead>
          <tr>
              <th data-options="field:‘ck‘,checkbox:true"></th>
              <th data-options="field:‘monitor_item_code‘,width:70,align:‘center‘">XXX</th>
              <th data-options="field:‘gap_value‘,width:70,align:‘center‘">XXX</th>
              <th data-options="field:‘remark‘,width:70,align:‘center‘">XXX</th>
              <th data-options="field:‘alarm_role‘,width:70,align:‘center‘,formatter:alarmRole">XXX</th>
              <th data-options="field:‘flag‘,width:70,align:‘center‘,formatter:flag,styler:flagColor">状态</th>
              <th data-options="field:‘operate‘,width:80,align:‘center‘,formatter:formatOper">操作</th>
          </tr>
         </thead>
    </table>

js:

function flagColor(val, row, index) {
    if (val == ‘1‘) {
        return ‘background:#B9F3B9‘;
    } else if (val == 0) {
        return ‘background:#FFCCCC‘;
    }
}
function flag(val, row, index) {
    return ‘<a href="javascript:void(0)" class="start"  onclick="changeFlag(‘ + index + ‘,1)"></a><a href="javascript:void(0)" class="stop" onclick="changeFlag(‘ + index + ‘,0)"></a>‘;
}

效果:

原文地址:https://www.cnblogs.com/raitorei/p/10395233.html

时间: 2024-08-25 10:29:25

easyui 改变单元格背景颜色的相关文章

ExtJS4.2 Grid知识点三:改变表格Grid单元格背景颜色

在ExtJS4.2 Grid知识点一:改变表格Grid单元格文字颜色一文中讲解了如何改变单元格中文字颜色,接下来在本章学习如何改变Grid中单元格的背景颜色,显示结果如图片: 在线演示  /  示例代码 实现方式同样是为Grid中该列自定义renderer函数,查询ExtJS 4.2 API得知,Ext.grid.column.Column的renderer属性可以是一个函数也可以是字符串,这个知识点是通过函数来实现的.函数参数列表如下: value : 当前待渲染的单元格值,即表格中某行某列的

NPOI Excel 单元格背景颜色对照表

NPOI Excel 单元格颜色对照表,在引用了 NPOI.dll 后可通过 ICellStyle 接口的 FillForegroundColor 属性实现 Excel 单元格的背景色设置,FillPattern 为单元格背景色的填充样式. NPOI Excel 单元格背景颜色设置方法以及颜色对照表: 1 2 3 4 5 6 ICellStyle style = workbook.CreateCellStyle(); style.FillForegroundColor = NPOI.HSSF.U

EXTJS根据值Value改变gridpanel单元格背景颜色或者设置整行字体颜色

第一步. 设置样式 .reportColor4{background: #93A9C1;}.reportColor5{background: #EEEEEE;} 第二步.修改单元格样式 header : '流通类型',width : 80,sortable : true,align : 'center',dataIndex: 'BR_TYPE',// css : 'background: #acdaf4;', // ----- 设置整个单元格的样式,但是不能根据条件变化renderer:func

NPOI 自定义单元格背景颜色-Excel

2016-12-27 10:44 by 杨新华, 5242 阅读, 0 评论, 收藏, 编辑 NPOI针对office2003使用HSSFWorkbook,对于offce2007及以上使用XSSFWorkbook:今天我以HSSFWorkbook自定义颜色为例说明,Office2007的未研究呢 在NPOI中默认的颜色类是HSSFColor,它内置的颜色有几十种供我们选择,如果不够怎么办,不能修改底层的HSSFColor类: 大概解决思路: 1.将颜色的RGB值添加进调色板HSSFPalette

C#对gridView的列和行以及单元格进行颜色设置

①字体 其中gridView是gridView的Name(下同) gridView[column, row].Style.ForeColor = Color.Red;//设置第row行column列的单元格字体颜色 gridView.Rows[row].DefaultCellStyle.ForeColor = Color.Red;//设置第row行的行字体颜色gridView.Columns[column].DefaultCellStyle.ForeColor = Color.Yellow;//

改变DataGrid某一行和单元格的颜色

前段时间做WPF项目,需要改变DataGrid某一行的颜色.高度,以及某个单元格的颜色.单元格字体的颜色,自然就必需取到datagrid的一行和一行的单元格,网上也是搜索了好久才找到,记录下来便于使用. 1.前台WPF界面添加一个DataGrid控件,并添加两列(便于编写,达到目的即可) <DataGrid AutoGenerateColumns="False" Height="642" HorizontalAlignment="Left"

c#winform中如何修改ListView控件每个单元格的颜色

ListView在View属性为Details的时候它呈现的方式和DataGirdView差不多,它的每一行都是一个ListViewItem,然而每个ListViewItem都有一个BackColor的属性,但是设置了这个属性却没有任何作用.因为是ListView的每一行的样式都继承的父控件的样式所以无法改变. 解决方案: ListViewItem item; item = new ListViewItem(new string[] { "NAME","" });

DevGridControl单元格背景色和单元格文字颜色设置

1.拖一个gridControl控件在 窗体上 2.添加三列 分别是 BgColor,BgColor2 , FontColor  分别显示单元格颜色 单元格渐变颜色 单元格字体颜色 public partial class Form1 : Form { public Form1() { InitializeComponent(); } private void Form1_Load(object sender, EventArgs e) { List<object> list = new Li

改变cell的背景颜色

#define DARK_BACKGROUND  [UIColor colorWithRed:151.0/255.0 green:152.0/255.0 blue:155.0/255.0 alpha:1.0]; - (void)tableView:(UITableView *)tableView willDisplayCell:(UITableViewCell *)cell forRowAtIndexPath:(NSIndexPath *)indexPath{    cell.backgroun