css - 在 typescript 中更改 gridready 上的 ag-grid 标题背景颜色

标签 css angular typescript ag-grid

我正在使用 Angular 6 。我在组件中使用 ag-grid 的地方。是否可以使用组件 CSS 或使用 gridready columnapi 或 rowapi 将背景颜色修改应用于 ag-grid 标题。我不想继承和创建自定义 header 组件。我尝试使用 ag-grid 文档中提到的 headerClass 属性,但这不起作用。我尝试在 CSS 中覆盖 .ag-header-container 类,但它没有得到反射(reflect)。

最佳答案

我能够通过在 onGridReady 中操作 CSS 类来解决这个问题。

css = document.getElementsByClassName('ag-header-
 viewport') as HTMLCollectionOf<HTMLElement>;
  css[0].style.backgroundColor = "#d4d4d4";

关于css - 在 typescript 中更改 gridready 上的 ag-grid 标题背景颜色,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52246228/

相关文章:

javascript - 使用 javascript/typescript 创建一个对象数组,使其具有 3 个数组的所有可能性组合

css - 如何设置 System.Web.Optimization bundler 以正确转换 ISO unicode

xhtml - 基础 - 在线设置 div 时,是否也 float ?

unit-testing - Angular2 单元测试 - 为什么 nativeElement 有空的 CSSStyleDeclaration

javascript - typescript 错误 : Property '0' is missing in type

javascript - 转到 Typescript Source Definition 而不是 Visual Studio Code 中的 Compiled Definition

css - 使用#IEroot 进行针对 ie 的样式?

html - 我怎样才能将我的 <ul> 移动到我想要的位置?

带路由器的 Angular2 Material 设计 mdtabs

angular - 我想将 angular2 observable 转换为一个类