Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Bootstrap Theme Not Being Applied

I'm trying to apply the Bootstrap theme to my datatable. I'm using ngx-datatable version 10.4.0 because I'm still on Angular 4 and 11.0 isn't compatible. According to the changelog, the Bootstrap theme was added in version 10.3.0.

Below is my 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>

However, this doesn't add the styling as in the demo. I think I have included everything the documentation shows.

I'm using Bootstrap 3.3.7. Is 4.0 required? Am I not including something correctly?

like image 945
Ryan Buening Avatar asked Nov 10 '17 17:11

Ryan Buening


1 Answers

Make sure you are including the scss file to your build.

In .angular-cli.json you should add it:

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

also the <ngx-datatable> element should have both bootstrap and ngx-datatable classes:

<ngx-datatable class="bootstrap ngx-datatable">
like image 89
Francesco Borzi Avatar answered Sep 22 '22 23:09

Francesco Borzi