带有选定行的 Ag-grid RowStyle [英] Ag-grid RowStyle with selected row

查看:27
本文介绍了带有选定行的 Ag-grid RowStyle的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用 ag-grid 5.1.2我已经配置了一个 getRowStyle 函数来为某些项目设置背景颜色.

I am using ag-grid 5.1.2 I've configured a getRowStyle function to set the background-color for certain items.

I've noticed that has overridden the 'selected row' color now, so when a row is selected the background will not change to indicate as such.
What is the correct way to still let highlighted row color work with自定义 getRowStyle.

这是 rowStyle 函数的打字稿:

I've noticed that has overridden the 'selected row' color now, so when a row is selected the background will not change to indicate as such.
What is the correct way to still let highlighted row color work with the custom getRowStyle.

Here is the typescript for the rowStyle function:

 self.customRowStyle = function (params: AgParams) {
    if (!params.data.isShaded) {
        return {
            'background-color': '#CEDDDD'
        };
    }
    return null;
}

推荐答案

使用 getRowClass gridOption 而不是 getRowStyle.然后在 CSS 中为突出显示的背景行和背景行设置适当的样式.

Use the getRowClass gridOption instead of getRowStyle. Then in CSS set the appropriate styles for your background row and the brackground row when highlighted.

这篇关于带有选定行的 Ag-grid RowStyle的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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