简体   繁体   English

在 SharePoint 框架 (SPFX) / Angular 中使用 ag-Grid - 样式失败

[英]Using ag-Grid within SharePoint Framework (SPFX) / Angular - styling failure

We're exploring custom SharePoint Web Parts using SharePoint Framework (SPFX) with Angular Elements.我们正在探索自定义 SharePoint Web 部件,使用 SharePoint 框架 (SPFX) 和 ZC31Z54466949Z 框架 (SPFX)。 I'd like to use ag-Grid but the style definitions of the grid contents don't seem to get applied.我想使用 ag-Grid 但网格内容的样式定义似乎没有得到应用。 Following the intro here , the HTML looks like this:按照这里的介绍,HTML 看起来像这样:

  <div class="ag-theme-material">
<ag-grid-angular
  style="width: 500px; height: 500px;"
  [rowData]="rowData"
  [columnDefs]="columnDefs"
>
</ag-grid-angular></div>

But the rendered page content looks like this:但是渲染的页面内容是这样的:

这是页面的样子

I've tried several of the bundled themes, and they all fail the same way.我已经尝试了几个捆绑的主题,它们都以同样的方式失败。

Has anyone tried using ag-Grid with Angular Elements and SharePoint Framework?有没有人尝试将 ag-Grid 与 Angular 元素和 SharePoint 框架一起使用? Any suggestions on how to get the styling to work?关于如何使样式起作用的任何建议?

So, you have documentation but you don't use class in the correct way.因此,您有文档,但没有以正确的方式使用 class。

The class should be added for ag-grid but not for extra div class 应该为ag-grid添加,但不是为额外的 div

在此处输入图像描述

in your case it should be:在您的情况下,它应该是:

<ag-grid-angular
  style="width: 500px; height: 500px;"
  class="ag-theme-material"
  [rowData]="rowData"
  [columnDefs]="columnDefs"
>
</ag-grid-angular>

One more one of the important things is definitions of styles in root styles.还有一件重要的事情是 styles 在根 styles 中的定义。

在此处输入图像描述

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM