- How do I install yajra/laravel-datatables-html for Laravel 12+?
- Run `composer require yajra/laravel-datatables-html:^13` and add `Builder::useVite()` in your `AppServiceProvider` to enable ViteJS module support. Ensure `yajra/laravel-datatables` is also installed as a dependency.
- Can this package handle large datasets (e.g., 50,000+ rows) efficiently?
- Yes, it leverages server-side processing via `yajra/laravel-datatables`, which offloads pagination, sorting, and filtering to your database. Monitor query performance and optimize with indexing or caching if needed.
- Does yajra/laravel-datatables-html work with Livewire 4?
- Yes, it supports Livewire 4+ via the `->useLivewire()` method. This enables reactive tables where client-side interactions (e.g., search) trigger server-side updates without full page reloads.
- How do I customize the DataTables HTML output (e.g., add buttons, change styling)?
- Use the builder methods like `->buttons()`, `->style()`, or `->className()` to modify appearance. For advanced customization, publish assets with `php artisan vendor:publish --tag=datatables-html` and extend via macros or JavaScript templates.
- Is this package compatible with Laravel 13, or should I wait for updates?
- The package supports Laravel 13 via the `^13` version tag. Check the [GitHub releases](https://github.com/yajra/laravel-datatables-html/releases) for breaking changes, but it’s generally stable for Laravel 11–13.
- Can I use this with Inertia.js or Alpine.js for SPAs?
- Yes, pass the DataTables configuration as props to Inertia.js components or use Alpine.js for lightweight client-side interactions. The package generates clean HTML/JS that integrates seamlessly with modern frontend stacks.
- How do I implement row-level permissions (e.g., hide columns for non-admin users)?
- Use `->visibleIf()` with Laravel’s auth helpers, Gates, or Policies. Example: `->column('secret_data')->visibleIf(fn() => auth()->user()->isAdmin)`. Combine with Laravel’s authorization system for granular control.
- What’s the difference between this package and client-side DataTables implementations?
- This package generates **server-side processed** tables via PHP, avoiding client-side bottlenecks for large datasets. Client-side implementations (e.g., jQuery DataTables with static JSON) load all data into memory, while this package streams results from the database.
- Does it support exporting data to CSV/Excel?
- Yes, use `->exportButtons()` to add export controls. For server-side exports, configure custom routes or leverage the `->buttons()` method with `Button::export()` for CSV/Excel downloads.
- Are there alternatives if I need real-time updates (e.g., WebSocket-based)?
- For real-time tables, pair this package with **Laravel Echo/Pusher** or **Livewire’s reactivity**. Use `->useLivewire()` for search-as-you-type or `->ajax()` with custom event listeners for WebSocket-driven updates.