【问题标题】:Getting Started demo for ag-grid - not showing grid as expectedag-grid 的入门演示 - 未按预期显示网格
【发布时间】:2019-02-23 08:13:40
【问题描述】:

我正在尝试为我的 Angular 6 应用程序处理“ag-grid”Typescript 网格组件。

该网站看起来很有前途,我一直在尝试让他们的“入门”演示在我的机器上运行 - 到目前为止没有任何运气。

我已经完成了设置步骤——有一个例外:我尝试使用“直接”CSS(而不是使用 SCSS)——因此我在我的 app.component.ts 中有这个:

@Component({
  selector: 'app-root',
  templateUrl: './app.component.html',
  styleUrls: ['./app.component.css',
              '../../node_modules/ag-grid-community/dist/styles/ag-grid.css',
              '../../node_modules/ag-grid-community/dist/styles/ag-theme-balham.css',
             ]
})

而不是他们在 styles.scss 文件中导入 CSS 的方法:

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

不确定,这是否是问题的根本原因 - 但我的数据在屏幕上显示非常乱码,根本不在网格中......(在 Chrome 和 Edge 中尝试过 - 结果相同):

【问题讨论】:

  • 尝试在 .angular-cli.json 文件中添加 css 导入

标签: angular ag-grid


【解决方案1】:

您应该将样式添加到您的 angular.json 文件中:

"styles": [ "node_modules/ag-grid-community/dist/styles/ag-grid.css", "node_modules/ag-grid-community/dist/styles/ag-theme-balham.css" ]

参见stackblitz 演示。

【讨论】:

    【解决方案2】:

    今天我忘记将父级div 中的ag-theme-alpine 替换为ag-theme-balham

    【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2019-07-30
    • 2019-04-20
    • 1970-01-01
    • 2021-10-20
    • 2020-08-17
    • 2016-08-02
    • 1970-01-01
    • 2019-03-16
    相关资源
    最近更新 更多