A frontend asset package for integrating Yajra's Laravel DataTables with Vite, jQuery, and Bootstrap 5. Current stable version 0.6.2, released June 2024. Automatically registers DataTables 2, Buttons, Select, and Editor plugins. Replaces the older laravel-datatables-vite version that relied on Mix/Webpack. Key differentiator: seamless Vite asset bundling for Laravel DataTables, removing manual CDN script management. Release cadence is irregular, with breaking changes in v0.6.0 requiring DataTables 2 upgrade.
npm install laravel-datatables-viteVerified import paths — ran on the pinned version, not inferred.
Shows minimal setup: import the package in JS, add required CSS imports in SCSS, and initialize a server-side DataTable with Laravel route.
Refer to DataTables 2 migration guide: https://datatables.net/upgrade/2
Use $('#table').DataTable() instead of $('#table').dataTable().Use ES module syntax: import 'laravel-datatables-vite';
Install 'datatables.net-editor-bs5' and import 'datatables.net-editor-bs5/js/editor.bootstrap5.min.js' if using Editor.
Use Bootstrap 5 (bootstrap@5.x) and ensure correct CSS imports.
Ensure jQuery is loaded globally (e.g., via CDN script or Vite config). Alternatively, import jQuery and attach to window: import $ from 'jquery'; window.$ = window.jQuery = $;
Ensure Bootstrap JS is loaded globally before DataTables Editor: import 'bootstrap' earlier in app.js.
npm install datatables.net-editor-bs5 --save-dev and add import 'datatables.net-editor-bs5/js/editor.bootstrap5.min.js' in app.js.
Change to $('#table').DataTable() (capital D) and ensure you have v0.6.2+.