Can I use datatable for my angular 5 application?

Can I use datatable for my angular 5 application?

shubhamnabshubhamnab Posts: 1Questions: 1Answers: 0

I am developing angular 5 application in node.js. Can I use datatable component in my application?


  • meiwalshmeiwalsh Posts: 1Questions: 0Answers: 0
    edited June 2018

    I am using angular 5 with datatable. You will need to install these:

    Bring in the plugin:

    npm install --save
    npm install @types/ --save . (this is needed for typescript compile)

    To style the table,
    For default style,

    npm install --save

    or for bootstrap,

    npm install --save

    Include datatables base css file globally (example in styles.css). you can also include the extensions css or in the component css:

    @import '../node_modules/';
    @import '../node_modules/';

    datatables extension
    I brought in 2 extensions and their corresponding styles: button, fixedcolumns :

    npm install --save
    npm install @types/ --save
    npm install --save
    npm install --save 
    npm install

    For details on other extensions, you will want to use the download feature in, select the extensions you want, scroll to the bottom and see the npm tab for the packages to install.

    In order for the plugin to compile without a problem, you will need to bring in each extension's typescript types definition. Unfortunately, not all plugins have that. To find what typings are available, you can use
    Fixedcolumns does not have its own typing file, so I include it in /src/typings.d.ts like this:

    declare namespace DataTables {
        interface Settings {
             * FixedColumns extension options
            fixedColumns?: any;

    I hope that helps.

  • rafysanchezrafysanchez Posts: 2Questions: 0Answers: 0

    Good job!

Sign In or Register to comment.