Using Datatable functionality in vue.js component

Using Datatable functionality in vue.js component

Umair ChauhanUmair Chauhan Posts: 1Questions: 1Answers: 0
edited June 2021 in DataTables

I am using laravel spark application. I want to use datatable draw function like this (
(#mytable).Datatable() ) in my vue.js component. But there is error that Datatable is not a function. i am using datatable through CDN.

Answers

  • colincolin Posts: 15,112Questions: 1Answers: 2,583

    If (#mytable) is supposed to to be jQuery selector, then it should be something like

    $('#mytable').DataTable()
    

    and then use draw(),

    Colin

  • allanallan Posts: 61,438Questions: 1Answers: 10,052 Site admin

    Also note the capital T in DataTable.

    Also worth noting is that I tend to use v-once on thr table to make sure that Vue and DataTables don't try to control the same DOM elements.

    Allan

Sign In or Register to comment.