Power-Components / livewire-powergrid

⚡ PowerGrid generates modern, powerful and easy-to-customize data tables using Laravel Livewire.
https://livewire-powergrid.com
MIT License
1.47k stars 215 forks source link

Feature Lazy Loading #1310

Closed luanfreitasdev closed 8 months ago

luanfreitasdev commented 8 months ago

⚡ PowerGrid - Pull Request

Motivation

Description

This PR generates some child components to lazy load when the parent component needs to load many records at once.

Example: Let's say you have to load 100 items at once on the page this can make the payload very large and will overload the server. In this case, for example, only 15 lines will be loaded and if you need to load more items, this will be done automatically when scrolling the screen.

public function setUp(): array
{
      return [
            // ...
            Lazy::make()
                ->dispatchAfterToggleDetail('toggleDetailFromChild')
                ->rowsPerChildren(15),
        ];
}

https://github.com/Power-Components/livewire-powergrid/assets/33601626/1728d767-71dd-4f68-87f1-22debecb64ab

Related Issue(s): #_____.

Documentation

This PR requires Documentation update?

https://github.com/Power-Components/powergrid-doc/pull/89