How to include DataTables in a Aurelia component?

How to include DataTables in a Aurelia component?

kintelakintela Posts: 5Questions: 1Answers: 0

Hi
I have an Aurelia project with several components and I would like to adda DataTables in one of then but I don't know how to add the references to the js and css files needed. I have installed the Core and the extensions with npm and I have in the node_modules all the folders with the files but wen I use
<template>
<require from="./../../node_modules/datatables.net/js/jquery.dataTables.min.js"></require>
the page gets me an error: aurelia-logging-console.js?dc89:47 ERROR [app-router] Error: Unable to find module with ID: datatables.net/js/jquery.dataTables.min.js

Any idea please?

regards

Answers

  • kintelakintela Posts: 5Questions: 1Answers: 0

    Sorry in te viewmodel I must import. Previously I have added in web pack.config.ts this:
    vendor: ["bluebird", "bootstrap", "aurelia-fetch-client","datatables.net"]
    And I try this: import {datatable} from "datatables.net"; but Typescript says that need some .d.ts

    Any idea please?

    regards

  • colincolin Posts: 15,240Questions: 1Answers: 2,599

    Hi @kintela ,

    I don't know anything about Aurelia I'm afraid, but it would be worth searching on Stackoverflow, there's a few threads on there about importing libraries into Aurelia (including a few mentioning DataTables).

    Cheers,

    Colin

This discussion has been closed.