Bootstrap主题未被应用

时间:2017-11-10 17:55:24

标签: ngx-datatable

我试图将Bootstrap主题应用于我的数据表。我使用ngx-datatable版本10.4.0因为我仍然使用Angular 4而且11.0不兼容。根据更改日志,Bootstrap主题已在版本10.3.0中添加。

以下是我的component.html:

<div>
    <ngx-datatable class="bootstrap" [rows]="rows" [columns]="columns" (select)='onSelect($event)' [selected]="selected" [selectionType]="'single'"
        [limit]="10" [columnMode]="'force'" [headerHeight]="40" [footerHeight]="40" [rowHeight]="'auto'">
    </ngx-datatable>
</div>

但是,这并没有像demo那样添加样式。我想我已经包含了documentation显示的所有内容。

我使用的是Bootstrap 3.3.7。需要4.0吗?我没有正确包含某些内容吗?

1 个答案:

答案 0 :(得分:5)

确保将scss file包含在您的版本中。

.angular-cli.json中你应该添加它:

"apps": [
  {
    ...
    "styles": [
      ...
      "../node_modules/@swimlane/ngx-datatable/release/themes/bootstrap.css",
      ...
    ],

<ngx-datatable>元素也应包含bootstrapngx-datatable类:

<ngx-datatable class="bootstrap ngx-datatable">