处理节点时如何在ag-Grid中设置单元格样式? [英] How to set cell style in ag-Grid while processing nodes?

查看:1019
本文介绍了处理节点时如何在ag-Grid中设置单元格样式?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

ag-Grid提供了一种使用cellStyle修改单元格样式的机制。

ag-Grid provides a mechanism using the cellStyle to modify the style of a cell.

但是,我想在处理节点时更改单元格的颜色。我知道要更改颜色的确切节点。

However, I want to change the color of a cell while processing nodes. I know the exact node which I want to change the color of.

有某种方法吗?

推荐答案

最简单解决方案是使用单元格渲染函数:

The simplest solution would be to use a cell rendering function:

// put the value in bold
colDef.cellRenderer = function(params) {
    return '<b>' + params.value.toUpperCase() + '</b>';
}

您可以根据节点的值应用样式-这将是在params参数中可用

You can apply the style depending on the value of the node - this will be made available in the params argument

这篇关于处理节点时如何在ag-Grid中设置单元格样式?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆