【问题标题】:Why is ag-theme-balham the only ag-grid theme that works?为什么 ag-theme-balham 是唯一有效的 ag-grid 主题?
【发布时间】:2020-03-28 10:10:56
【问题描述】:

我将ag-grid 添加到我的 Angular 项目中。然后我将它的 CSS 导入到styles.css

@import "~@ag-grid-community/all-modules/dist/styles/ag-grid.css";
@import "~@ag-grid-community/all-modules/dist/styles/ag-theme-balham.css";

到目前为止,一切都很好。 ag-theme-balham 主题在我运行应用程序时出现。

但是,现在我想更改主题。但无论我选择哪个其他主题的 CSS,都不会显示样式。即使ag-theme-balham-dark 也不起作用。

已验证:

  • 其他主题的 CSS 文件存在于 node_modules
  • Angular 项目编译。
  • 控制台中没有错误。

【问题讨论】:

    标签: ag-grid ag-grid-angular


    【解决方案1】:

    ag-grid-angular 有一个你也必须更新的类属性:

    <ag-grid-angular 
        *ngIf="rowData"
        style="width: 500px; height: 500px;" 
        class="ag-theme-balham"    <!-- Update this -->
        [rowData]="rowData" 
        [columnDefs]="columnDefs"
        [modules]="modules">
    </ag-grid-angular>
    

    【讨论】:

    • 有什么办法可以全局设置吗?
    【解决方案2】:

    某些主题仅在 ag-grid 的更新版本中可用。您可能需要检查您正在使用的主题的可用性。

    更多信息:

    https://www.ag-grid.com/javascript-grid-themes-provided/

    https://www.ag-grid.com/javascript-grid-themes-v23-migration/

    【讨论】:

      猜你喜欢
      • 2021-04-16
      • 1970-01-01
      • 2018-08-17
      • 1970-01-01
      • 1970-01-01
      • 2019-11-14
      • 2021-02-09
      • 1970-01-01
      • 2020-08-19
      相关资源
      最近更新 更多