Ngx-datatable: Bootstrap theme is not working

Created on 4 Apr 2018  路  11Comments  路  Source: swimlane/ngx-datatable








I'm submitting a ... (check one with "x")

[ ] bug report => search github for a similar issue or PR before submitting
[ ] feature request
[ ] support request => Please do not submit support request here, post on Stackoverflow or Gitter

Current behavior

Expected behavior

Reproduction of the problem

What is the motivation / use case for changing the behavior?

Please tell us about your environment:

  • Table version: 0.8.x

  • Angular version: 2.0.x

  • Browser: [all | Chrome XX | Firefox XX | IE XX | Safari XX | Mobile Chrome XX | Android X.X Web Browser | iOS XX Safari | iOS XX UIWebView | iOS XX WKWebView ]

  • Language: [all | TypeScript X.X | ES6/7 | ES5]

I tried to add the bootstrap them on a component but it's not working
As per the bootstrap component https://github.com/swimlane/ngx-datatable/blob/master/demo/basic/bootstrap.component.ts :
My component :
@Component({ selector: 'basic-bootstrap-theme-demo', template:


class="bootstrap"
[rows]="rows"
[loadingIndicator]="loadingIndicator"
[columns]="columns"
[columnMode]="'force'"
[headerHeight]="40"
[footerHeight]="40"
[limit]="10"
[rowHeight]="'auto'"
[reorderable]="reorderable">


`
})
export class BootstrapThemeComponent {

rows = [];
loadingIndicator: boolean = true;
reorderable: boolean = true;

columns = [
{ prop: 'name' },
{ name: 'Gender' },
{ name: 'Company' }
];

constructor() {
this.fetch((data) => {
this.rows = data;
setTimeout(() => { this.loadingIndicator = false; }, 1500);
});
}

fetch(cb) {
const req = new XMLHttpRequest();
req.open('GET', https://raw.githubusercontent.com/swimlane/ngx-datatable/master/assets/data/company.json);

req.onload = () => {
  cb(JSON.parse(req.response));
};

req.send();

}

}`

My component css :

@import '~@swimlane/ngx-datatable/release/index.css'; @import '~@swimlane/ngx-datatable/release/themes/bootstrap.css'; @import '~@swimlane/ngx-datatable/release/assets/icons.css';

I includes bootstrap 3.3.7 link in the index.html page

Here is the result
2018-04-04_175241
It should look like :+1
2018-04-04_175532

Solution:

ADD themes in parent styles.css file but the folllowing problem occur ;
2018-04-04_182310

Most helpful comment

Adding this to the styles.css file worked for me
@import "../node_modules/@swimlane/ngx-datatable/release/themes/bootstrap.css"

All 11 comments

I'm having the same issue with dark bottom panel when adding the css sheets to my component's .scss file! Any idea what's causing that?

same here

Have you tried adding it to styles in angular-cli.json ?

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

@kcbroomall I did try adding it to the angular-cli.json but still getting the same dark bottom pagination panel.

try to remove the default css of datatable into the angular-cli.json styles
2018-04-19_150306

This should do the trick, css conflict, I think . It works with me

I'm having the same issue and the only way I get rid of it is to remove my actual boostrap.css which obviously I cannot do.

"bootstrap": "^3.3.7"
"@swimlane/ngx-datatable": "^13.1.0"

"styles": [
              "node_modules/bootstrap/dist/css/bootstrap.min.css",
              "node_modules/@fortawesome/fontawesome-pro/css/all.min.css",
              "node_modules/@swimlane/ngx-datatable/release/index.css",
              "node_modules/@swimlane/ngx-datatable/release/themes/bootstrap.css",
              "node_modules/@swimlane/ngx-datatable/release/assets/icons.css",
              "src/styles.css"
            ],

If I remove node_modules/bootstrap/dist/css/bootstrap.min.css the issue goes away

@timothyblue ... but if you integrate with AdminLTE, your action will be destroying the AdminLTE themes.

I'm still not yet found the solution of this integration and why it could be happened

Adding this to the styles.css file worked for me
@import "../node_modules/@swimlane/ngx-datatable/release/themes/bootstrap.css"

I have this same issue when I build Angular 6 with Production configuaration but is okay with dev. It looks due to the following. This works fine in Angular 5. Also, this may be similiar to CleanCss issue -
https://github.com/angular/angular-cli/issues/10186

 .ngx-datatable.bootstrap .datatable-footer {
background: #424242;
color: #ededed;
margin-top: -1px; }

This shows up in dev as:

.ngx-datatable.bootstrap .datatable-footer{
background:#fff;
color:#000;
margin-top:-1px}

I'm still having issues with it, my table looks all white.
image

This is my angular.json
image

Guys can you please also update the docs ?

Same here. Does anybody could resolve this??

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Csirme picture Csirme  路  3Comments

WA-WilliamKrieg picture WA-WilliamKrieg  路  3Comments

eddy-geek picture eddy-geek  路  3Comments

JanStock picture JanStock  路  3Comments

Matthi0uw picture Matthi0uw  路  3Comments