- How do I quickly set up a basic data table with PowerGrid in Laravel Livewire?
- Install via Composer (`composer require power-components/livewire-powergrid`), publish assets/config (`php artisan vendor:publish --tag=powergrid-assets --tag=powergrid-config`), then define a `datasource()` method in your Livewire component. PowerGrid activates pagination, sorting, and filtering by default with just 10 lines of code.
- Does PowerGrid work with Laravel 9 or older versions?
- No, PowerGrid v6.10.x requires Laravel 10+. For older versions, check the GitHub releases for legacy branches, but they may lack critical updates or Livewire 3.x compatibility. Upgrade to Laravel 10+ for full feature support.
- Can I customize the styling to match my Tailwind CSS or Bootstrap 5 project?
- Yes, PowerGrid supports both Bootstrap 5 and Tailwind CSS 3/4 out of the box. For custom themes, override the default CSS classes in your project’s stylesheet. The package provides hooks to modify the table’s HTML structure if deeper customization is needed.
- How does PowerGrid handle large datasets for exports (e.g., 50K+ rows)?
- PowerGrid uses Laravel queues to process large exports via OpenSpout, preventing timeouts. For datasets >10K rows, ensure your queue worker (`php artisan queue:work`) is configured with sufficient memory and chunking. Test with `queue:failed` monitoring for robustness.
- What if my Eloquent query involves complex joins or raw SQL that PowerGrid doesn’t support?
- PowerGrid is query-builder agnostic, so you can pass any Eloquent query or raw SQL in `datasource()`. For nested relationships, use `with()` or eager loading in your query. Complex subqueries may require manual optimization, but PowerGrid won’t block them.
- Are there performance concerns with PowerGrid for high-traffic admin panels?
- PowerGrid is optimized for most use cases, but complex joins or unoptimized queries in `datasource()` can degrade performance. Test with realistic data volumes and consider adding database indexes. For heavy loads, use Livewire’s `public` property caching or paginate results early.
- How do I add custom filters or search logic beyond the default global search?
- Use the `addFilter()` method in your component to define custom filters. For advanced logic, override the `transformQuery()` lifecycle hook to modify the query dynamically. Example: `public function transformQuery($query) { return $query->where('status', $this->statusFilter); }`.
- Can I integrate PowerGrid with Livewire actions like alerts or notifications?
- Yes, PowerGrid supports action buttons (e.g., edit, delete) with callbacks. Use the `addAction()` method to define custom actions, then trigger Livewire events or emit JavaScript (e.g., `emit('alert', 'Item deleted')`) to sync with your UI.
- What’s the best way to test PowerGrid components in CI/CD?
- Test PowerGrid by mocking the `datasource()` method in unit tests (e.g., with Laravel’s `Mockery`). For end-to-end tests, use Laravel Dusk or Pest to verify pagination, sorting, and exports in a staging environment. Load test with tools like k6 to simulate concurrent users.
- Are there alternatives to PowerGrid for Laravel Livewire data tables?
- Alternatives include **Filament Tables**, **Laravel Nova**, or **Livewire DataTables**. PowerGrid stands out for its minimal setup, Livewire-first design, and built-in export/CRUD features. Nova is more enterprise-focused, while Filament offers a broader admin panel suite. Choose based on your need for simplicity vs. extensibility.