ngx-datatable icon indicating copy to clipboard operation
ngx-datatable copied to clipboard

styles not working with ionic 3

Open praveens96 opened this issue 7 years ago • 3 comments

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

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

Current behavior

I am trying to use the library with my ionic app. The styles are not coming up as in demo's. none of the styles are coming up screen shot 2018-01-20 at 11 39 35 am

Expected behavior

screen shot 2018-01-20 at 11 40 06 am

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]

praveens96 avatar Jan 20 '18 06:01 praveens96

Hey @praveens96, I am also using ngx-datatable with Ionic. I had some difficulties linking the stylesheets but got it working in the end.

This is what I have in my 'src/app/app.scss' file:

@import '../assets/styles/ngx-datatable/index';
@import '../assets/styles/ngx-datatable/material';
@import '../assets/styles/ngx-datatable/bootstrap';

You need to rename the css files to .scss and prepend an underscore for Sass to import these files. For example in my ngx-datatable folder (under assets/styles) my files are called:

_index.scss
_material.scss
_bootstrap.scss

Hope this helps!

Corona17 avatar Jan 23 '18 00:01 Corona17

The same issue I faced while working with Angular (not ionic). Even after doing that, it didn't work for me. I had to use class='material' on the ngx-datatable element in the markup. Try adding it. Hope it helps!

paritosh64ce avatar Jan 23 '18 11:01 paritosh64ce

I ended up editing angular.json and adding the files to the styles section:

  "projects": {
      "architect": {
        "build": {
          "builder": "@angular-devkit/build-angular:browser",
          "options": {
            ...
            "styles": [
              {
                "input": "src/theme/variables.scss"
              },
              {
                "input": "src/global.scss"
              },
              {
                "input": "node_modules/@swimlane/ngx-datatable/index.scss"
              },
              {
                "input": "node_modules/@swimlane/ngx-datatable/themes/material.scss"
              },
              {
                "input": "node_modules/@swimlane/ngx-datatable/assets/icons.css"
              }
            ],
           ...

saschwarz avatar Mar 12 '23 19:03 saschwarz