anonymus
anonymus

Reputation: 171

How can I use DataTable plugin with Laravel Vue.js project?

Currently, I am enhancing my Laravel application with Vue js. And I want to display the data in jQuery DataTable. Please, someone, suggest to me how to do this as I am new to Vue js. Much appreciated if someone could suggest me a good tutorial on this.Thank you.

Upvotes: 0

Views: 501

Answers (1)

Waleed Muaz
Waleed Muaz

Reputation: 800

See Here Install the package To install this package, simply install vuejs-datatable with your favorite package manager:

npm install vuejs-datatable
yarn add vuejs-datatable

Import & register the DatatableFactory in Vue:

import Vue from 'vue';
import { VuejsDatatableFactory } from 'vuejs-datatable';

Vue.use( VuejsDatatableFactory );

In your HTML, load the IIFE build directly, if possible right before the closing tag. You must make sure that the loading order is preserved, like below.

<body>
    <!-- All your page content... -->
    <script src="https://cdnjs.cloudflare.com/ajax/libs/vue/2.4.2/vue.js" defer></script> 
    <script src="/dist/vuejs-datatable.js" defer></script> 
    <script src="/myscript.js" defer></script> 
</body>

Upvotes: 1

Related Questions